-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: go version -m exits with status 0 upon error #66426
Comments
Fixes golang#66426 Change-Id: Ie07ab6012063c0f087fd0525812079764444f8fa
Change https://go.dev/cl/573295 mentions this issue: |
I think this error can be a little misleading. Not all Go binaries have embedded build info. We should probably return a non zero exit but for maybe we should reword the error to not mislead people. |
Fixes golang#66426 Change-Id: Ie07ab6012063c0f087fd0525812079764444f8fa
error(could not read Go build info from /bin/sh: not a Go executable) from debug.ReadFile. |
Go version
go version go1.22.1 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Run
go version -m
on a non-Go executable, and then test the exit code of the go command. My use case is writing a script that detects whether a file is a Go executable or not, and only runs certain logic if so.What did you see happen?
I saw a zero exit code, indicating success:
What did you expect to see?
Since
go version -m
encountered an error, I expected to see a non-zero exit code, e.g.:The text was updated successfully, but these errors were encountered: