Skip to content
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: inconsistency between GOARCH and go tool #6201

Closed
bradfitz opened this issue Aug 20, 2013 · 2 comments
Closed

cmd/go: inconsistency between GOARCH and go tool #6201

bradfitz opened this issue Aug 20, 2013 · 2 comments
Milestone

Comments

@bradfitz
Copy link
Contributor

If I set GOARCH=386 on my amd64 machine, go install puts binaries in pkg/tool/darwin_386.

But if I then run "go tool api" (with GOARCH=386 still set), it doesn't find
it in pkg/tool/darwin_386.

This seems weird.  Is that by design?  Or just omission in "go tool" to search
for it elsewhere?

$ GOARCH=386 go install -a -x ...
.....
mkdir -p /Users/bradfitz/go/pkg/tool/darwin_386/
cp $WORK/cmd/api/_obj/exe/a.out /Users/bradfitz/go/pkg/tool/darwin_386/api

mac:src bradfitz$ GOARCH=386 go tool api
go tool: no such tool "api"
@robpike
Copy link
Contributor

robpike commented Aug 20, 2013

Comment 1:

Sounds like a bug to me. Not sure cross-compiling 'go tool' has been used much.

Labels changed: added priority-later, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Sep 10, 2013

Comment 2:

GOARCH sets the kind of binary to build.
You might be cross-compiling: GOARCH might be arm.
You definitely don't want to run the arm tool on an x86 system.
The host system type is GOHOSTARCH.
To install the api tool (or any tools) you need to use
    GOARCH=$(go env GOHOSTARCH) go install .../api
and then plain 'go tool' will find them.
make.bash does this for the standard tools. api/run.go needs
to do it for the api tool, because the api tool is not being built
as part of the standard tools.
Russ

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants