josephspurrier / goversioninfo

Golang Microsoft Windows File Properties/Version Info and Icon Resource Generator
MIT License
836 stars 115 forks source link

"goversioninfo": executable file not found in $PATH #23

Closed pacarvalho closed 6 years ago

pacarvalho commented 6 years ago

When attempting to run go generate using your software on OSX the following error appears on the terminal:

main_test.go:1: running "goversioninfo": exec: "goversioninfo": executable file not found in $PATH

I did not find a step relating to adding goversioninfo to the $PATH. Is there something that I am missing?

I am cross compiling for Windows 7 32 bits but I am developing on a Mac OSX.

pacarvalho commented 6 years ago

I discovered the problem! I forgot to add /bin in the end of filepath in .bash_profile. Now have some other issues to solve before this works but should be straightforward.

pacarvalho commented 5 years ago

This was a long time ago. Here is what I remember:

Cross compiling to win32 with icon and manifest

  1. Install versioninfo

    go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
  2. Run

    go generate
  3. Build without specifying input file

GOOS=windows GOARCH=386 go build -o <DEST_FOLDER>/dbf-watcher.exe

In order to get the above to work I had the following files and code:

versioninfo.json

{
  "FixedFileInfo": {
    "FileVersion": {
      "Major": 0,
      "Minor": 1,
      "Patch": 0,
      "Build": 0
    },
    "ProductVersion": {
      "Major": 0,
      "Minor": 1,
      "Patch": 0,
      "Build": 0
    },
    "FileFlagsMask": "3f",
    "FileFlags ": "00",
    "FileOS": "040004",
    "FileType": "01",
    "FileSubType": "00"
  },
  "StringFileInfo": {
    "Comments": "",
    "CompanyName": "Avansoft Solucoes de Tecnologia Ltda",
    "FileDescription": "",
    "FileVersion": "",
    "InternalName": "",
    "LegalCopyright":
      "Avansoft Solucoes de Tecnologia Ltda. Todos os diretos reservados.",
    "LegalTrademarks": "",
    "OriginalFilename": "",
    "PrivateBuild": "",
    "ProductName": "",
    "ProductVersion": "v0.1.0.0",
    "SpecialBuild": ""
  },
  "VarFileInfo": {
    "Translation": {
      "LangID": "0409",
      "CharsetID": "04B0"
    }
  },
  "IconPath": "icon.ico",
  "ManifestPath": "dbf-watcher.exe.manifest"
}

dbf-watcher.exe.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    type="win32"
    name="br.com.avantsoft.dbfwatcher"
    version="0.1.0.0"
    processorArchitecture="*"/>
</assembly>

Hopefully that was all... Let me know if this helps.

im2nguyen commented 5 years ago

Thanks! Went back and reread your answer... my PATH didn't contain ~/go/bin for some reason. After adding it to path, it worked. Thanks again!

manazoid commented 2 years ago

I have the same issue on Windows 11 go:generate gives me this: main.go:1: running "goversioninfo": exec: "goversioninfo": executable file not found in %PATH%

larry19840909 commented 2 years ago

i keep on getting this error on windows in vscode? any suggestions. i tried putting the following line above source code //go:generate goversioninfo -icon=icon.ico -manifest=myfile.exe.manifest

and then when i try to build it using go generate and go build it still gives same error

I have the same issue on Windows 11 go:generate gives me this: main.go:1: running "goversioninfo": exec: "goversioninfo": executable file not found in %PATH%

use go install

bling-yshs commented 5 months ago

for win11:

  1. go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo
  2. restart goland or vscode
  3. go generate