You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently when crosscompiling gobuild will place the binary files for the non-native
os/architectures in a subdirectory in GOBIN, but for native os/arch they are placed at the root of GOBIN.
would be nice to have an option that specifies (or forces) the subdirectory within GOBIN so native builds can be packaged with the same code as crosscompilations.
e.g)
GOOS=linux GOARCH=amd64 go build --subdirectory=$GOOS\_$GOARCH {package}
tar -cf {name}-$GOOS-$GOARCH.tar.gz --directory $GOBIN/$GOOS\_$GOARCH .
GOOS=linux GOARCH=386 go build --subdirectory=$GOOS\_$GOARCH {package}
tar -cf {name}-$GOOS-$GOARCH.tar.gz --directory $GOBIN/$GOOS\_$GOARCH .
instead I need to do some checking to determine current goos/arch and treat that one dfferently.
The text was updated successfully, but these errors were encountered:
minux
changed the title
gobuild inconsistent directory structure.
cmd/go: go build inconsistent directory structure
May 30, 2015
It's not obvious to me we want more options. It might be that instead we should have an output line in "go env" that says where the binaries will be written. Then a script could look at that value to find out where to read them from.
I looked into adding something to 'go env' but the result depends on which package we're talking about. So it can't be printed from 'go env'. It can be printed from 'go list', which can be told what package to use, and in fact it already is:
$ go list -f '{{.Target}}' cmd/go rsc.io/toolstash golang.org/x/tools/cmd/godoc
/Users/rsc/go/bin/go
/Users/rsc/bin/toolstash
/Users/rsc/go/bin/godoc
$ GOOS=linux go list -f '{{.Target}}' cmd/go rsc.io/toolstash golang.org/x/tools/cmd/godoc
/Users/rsc/go/bin/linux_amd64/go
/Users/rsc/bin/linux_amd64/toolstash
/Users/rsc/go/bin/linux_amd64/godoc
$
currently when crosscompiling gobuild will place the binary files for the non-native
os/architectures in a subdirectory in GOBIN, but for native os/arch they are placed at the root of GOBIN.
would be nice to have an option that specifies (or forces) the subdirectory within GOBIN so native builds can be packaged with the same code as crosscompilations.
e.g)
instead I need to do some checking to determine current goos/arch and treat that one dfferently.
The text was updated successfully, but these errors were encountered: