diff --git a/go/loader/stdlib_test.go b/go/loader/stdlib_test.go index e0277751..21a48b46 100644 --- a/go/loader/stdlib_test.go +++ b/go/loader/stdlib_test.go @@ -116,10 +116,14 @@ func TestStdlib(t *testing.T) { func TestCgoOption(t *testing.T) { switch runtime.GOOS { - // on these systems, the net and os/user packages don't use cgo. + // On these systems, the net and os/user packages don't use cgo. case "plan9", "solaris", "windows": return } + // For linux-amd64-nocgo, cgo is not used. + if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" && !build.Default.CgoEnabled { + return + } // Test that we can load cgo-using packages with // CGO_ENABLED=[01], which causes go/build to select pure // Go/native implementations, respectively, based on build