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
says file not executable on cross-compiled binary
#53681
Comments
Is it for any build executable? can you share a built artifact? |
It's for any executable. |
go/src/cmd/go/internal/version/version.go Lines 112 to 118 in c111091
Looking at the code, it works as expected, although I agree it could be smarter. Somehow related to #48187. |
Obviously when you compile for other systems extension could be missing. I think this check is unnecessary. Moreover checking executable bit on Unix (if I understand logic correctly) also makes no sense. What if I just unzipped this from the archive and want to check that info. Why should I make it runnable just to be able to analyze contents? This misleads: "runnable" or "allowed to run" != "executable". |
Change https://go.dev/cl/391855 mentions this issue: |
I've updated CL 391855 to remove the is-executable check, so all files go through |
391855 had been merged, I think this can be closed. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
On a Windows machine I compiled a Linux binary with
GOOS=linux go build
, then I triedgo version <binary>
andgo version -m <binary>
.In both cases the result was:
When I run
file <binary>
I see the following:What did you expect to see?
Build info for that binary.
What did you see instead?
Above message.
The text was updated successfully, but these errors were encountered: