From d76c7d5a31ffaba3134f16981abd5f891fa2d805 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 22 Sep 2017 10:30:45 -0700 Subject: [PATCH] [release-branch.go1.4] go/build: don't enable cgo for any system by default The 1.4 branch is now used only for building more recent releases. Enabling cgo is not required for that, and tends to cause problems as systems and compilers change. Updates #21054 Change-Id: I498f493e3ac32bcea55725cf5de3b3172f0fd5db Reviewed-on: https://go-review.googlesource.com/65450 Reviewed-by: Joe Tsai Run-TryBot: Joe Tsai --- src/go/build/build.go | 25 +++---------------------- src/make.bash | 1 + 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/go/build/build.go b/src/go/build/build.go index 311ecb01f4..c532549cd7 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -256,28 +256,9 @@ func (ctxt *Context) SrcDirs() []string { // if set, or else the compiled code's GOARCH, GOOS, and GOROOT. var Default Context = defaultContext() -var cgoEnabled = map[string]bool{ - "darwin/386": true, - "darwin/amd64": true, - "dragonfly/386": true, - "dragonfly/amd64": true, - "freebsd/386": true, - "freebsd/amd64": true, - "freebsd/arm": true, - "linux/386": true, - "linux/amd64": true, - "linux/arm": true, - "android/386": true, - "android/amd64": true, - "android/arm": true, - "netbsd/386": true, - "netbsd/amd64": true, - "netbsd/arm": true, - "openbsd/386": true, - "openbsd/amd64": true, - "windows/386": true, - "windows/amd64": true, -} +// On the 1.4 branch, cgo is not enabled by default for any system. +// Set CGO_ENABLED=1 when running make.bash to enable cgo. +var cgoEnabled = map[string]bool{} func defaultContext() Context { var c Context diff --git a/src/make.bash b/src/make.bash index fbc6f5d89d..104c3ba5fb 100755 --- a/src/make.bash +++ b/src/make.bash @@ -29,6 +29,7 @@ # CGO_ENABLED: Controls cgo usage during the build. Set it to 1 # to include all cgo related files, .c and .go file with "cgo" # build directive, in the build. Set it to 0 to ignore them. +# The default for this release is 0. # # GO_EXTLINK_ENABLED: Set to 1 to invoke the host linker when building # packages that use cgo. Set to 0 to do all linking internally. This