I've been trying to figure out how to make my programs build statically by default without specifying -a -installsuffix cgo -ldflags '-extldflags "-static" -s for every project. I've read through #9344, and supposedly the change to make dynamic builds the default is only for released versions of Go. Accordingly, I tried the following:
- Install Go onto my system from a package manager
- Check out go1.5.1 from Git
- Set
GOROOT to point to the checked-out version of Go, and GOROOT_BOOTSTRAP to the system version of Go
cd src; ./all.bash -- successful
rm -rf $GOPATH/pkg
- Start a new shell with GOPATH, GOROOT, and PATH all set appropriately. I can verify that I'm using the self-compiled version of Go (which itself was built dynamically), but binaries produced with my self-built Go are still being built dynamically without passing in
-a -installsuffix cgo -ldflags '-extldflags "-static" -s
Is this a bug, or did I misinterpret the requirements in #9344?
Thanks!
I've been trying to figure out how to make my programs build statically by default without specifying
-a -installsuffix cgo -ldflags '-extldflags "-static" -sfor every project. I've read through #9344, and supposedly the change to make dynamic builds the default is only for released versions of Go. Accordingly, I tried the following:GOROOTto point to the checked-out version of Go, andGOROOT_BOOTSTRAPto the system version of Gocd src; ./all.bash-- successfulrm -rf $GOPATH/pkg-a -installsuffix cgo -ldflags '-extldflags "-static" -sIs this a bug, or did I misinterpret the requirements in #9344?
Thanks!