Skip to content

build: CGO_ENABLED=0 ./make.bash does not force default in later runs of cmd/go #12808

Closed
@jefferai

Description

@jefferai

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:

  1. Install Go onto my system from a package manager
  2. Check out go1.5.1 from Git
  3. Set GOROOT to point to the checked-out version of Go, and GOROOT_BOOTSTRAP to the system version of Go
  4. cd src; ./all.bash -- successful
  5. rm -rf $GOPATH/pkg
  6. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions