]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "cmd/go: disable cgo by default if CC unset and DefaultCC doesn't exist"
authorMichael Matloob <matloob@google.com>
Fri, 19 Sep 2025 16:25:20 +0000 (09:25 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 19 Sep 2025 16:49:38 +0000 (09:49 -0700)
This reverts commit c2d85eb999fcd428a1cd71ed93805cbde0c16eaa.

Reason for revert: change was incorrect. ignores setting of CGO_ENABLED in some cases

Change-Id: I8e6e68dd600be5306a247a3314f4b57175f1aa56
Reviewed-on: https://go-review.googlesource.com/c/go/+/705495
Auto-Submit: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Alexander <jitsu@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/internal/cfg/cfg.go

index 97e4eeeff3c8cf93b629c0c3069052f5f6a289be..a4edd854f1d35a787b4768c00ed3688a42948d5e 100644 (file)
@@ -145,8 +145,7 @@ func defaultContext() build.Context {
        if buildcfg.DefaultCGO_ENABLED == "1" {
                defaultCgoEnabled = true
        } else if buildcfg.DefaultCGO_ENABLED == "0" {
-       }
-       if runtime.GOARCH == ctxt.GOARCH && runtime.GOOS == ctxt.GOOS {
+       } else if runtime.GOARCH == ctxt.GOARCH && runtime.GOOS == ctxt.GOOS {
                defaultCgoEnabled = platform.CgoSupported(ctxt.GOOS, ctxt.GOARCH)
                // Use built-in default cgo setting for GOOS/GOARCH.
                // Note that ctxt.GOOS/GOARCH are derived from the preference list