Go version

go version go1.24.6 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1243553581=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.6'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

When running on an AMD64 (x86) machine, running:

$ go install gitlab.com/tanna.dev/dependabot-graph@latest
$ ls -al /go/bin
-rwxr-xr-x 1 root root 8736189 Aug 12 18:41 dependabot-graph

Then, if we attempt to go install when cross-compiling:

$ env GOOS=linux GOARCH=arm64 go install gitlab.com/tanna.dev/dependabot-graph@latest
$ ls /go/bin/* -al
-rwxr-xr-x 1 root root 8736189 Aug 12 18:41 /go/bin/dependabot-graph

/go/bin/linux_arm64:
total 7988
drwxr-xr-x 2 root root    4096 Aug 12 18:43 .
drwxrwxrwt 1 root root    4096 Aug 12 18:43 ..
-rwxr-xr-x 1 root root 8170425 Aug 12 18:43 dependabot-graph

What did you see happen?

When specifying a custom GOOS and GOARCH, the installed binary (dependabot-graph ) is installed to a different path, /go/bin/linux_arm64/dependabot-graph

What did you expect to see?

When specifying a custom GOOS and GOARCH, the installed binary (dependabot-graph ) is installed to the same path when not specifying a custom GOOS and GOARCH, /go/bin/dependabot-graph

Comment From: seankhliao

seems we may be missing some documentation, but this is working as intended.

see also #57485

Comment From: gabyhelp

Related Issues

Related Discussions

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)