josephspurrier / goversioninfo

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

update go 1.18 - no goversion found #57

Open Pretexts opened 2 years ago

Pretexts commented 2 years ago

2022/03/21 14:58:13 Error when extracting compiler information: no goversion found

shrinidhi111 commented 2 years ago

Same error encountered in GitHub Actions.

I had to downgrade to go 1.17.x for it to work

josephspurrier commented 2 years ago

Interesting - I see the error message on only a few other projects. Can you provide more details on how to reproduce please?

brushknight commented 2 years ago

Hello @josephspurrier! We faced the same issue, let me share some steps to reproduce.

https://github.com/newrelic/infrastructure-agent/runs/6113650941?check_suite_focus=true https://github.com/newrelic/infrastructure-agent/blob/ci_test_go1-18/.github/workflows/prerelease_windows.yml#L63-L65 https://github.com/newrelic/infrastructure-agent/blob/ci_test_go1-18/build/windows/build.ps1#L41

https://github.com/newrelic/infrastructure-agent/blob/ci_test_go1-18/cmd/newrelic-infra/newrelic-infra.go#L3

Could you help us to understand what went wrong?

Thank you 🙂

josephspurrier commented 2 years ago

@brushknight Ah, it may be related to this change in the Go language: https://go.dev/doc/go-get-install-deprecation. Can you change this line to go install? https://github.com/newrelic/infrastructure-agent/blob/master/build/windows/build.ps1#L41

KempWatson commented 2 years ago

Same issue here, on Go 1.19.2: exec: "goversioninfo": executable file not found in $PATH

josephspurrier commented 2 years ago

Same issue here, on Go 1.19.2: exec: "goversioninfo": executable file not found in $PATH

Can you try the fix in: https://github.com/josephspurrier/goversioninfo/issues/57#issuecomment-1105319291?

KempWatson commented 2 years ago

That worked for Windows, but not for cross-compilation...so looks like it's just the instruction page perhaps that needs updating for Windows. Cross-compilation, at least on an M1 Mac, can't find the goversioninfo executable it seems.

josephspurrier commented 2 years ago

That worked for Windows, but not for cross-compilation...so looks like it's just the instruction page perhaps that needs updating for Windows. Cross-compilation, at least on an M1 Mac, can't find the goversioninfo executable it seems.

Are you able to post examples? Cross-compilation has its own challenges (different PATH variables, different Go versions, etc.) so I want to make sure it doesn't confuse the initial problem that Go changed how it works in newer versions which is not a bug with goversioninfo.

shenke-adsk commented 1 year ago

To add to the discussion, we recently encountered the same problem in our project which uses cross-compile to build a Windows binary on Linux. goversioninfo was not found in PATH for Go version 1.18 and up. We finally fixed it with go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest command. This is what we are doing:

fhcat@ECS-053990d6:~/garasign/repos/garasign$ go_img='docker.io/golang:1.19.3-buster'
fhcat@ECS-053990d6:~/garasign/repos/garasign$ docker run -v $HOME/garasign/repos/garasign2:/garasign -t ${go_img} /bin/bash -c 'cd /garasign; go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest; which goversioninfo'
go: downloading github.com/josephspurrier/goversioninfo v1.4.0
go: downloading github.com/akavel/rsrc v0.10.2
/go/bin/goversioninfo