From 1bd4ccf210abd566d1ad6abfd0bcdc6257f265e2 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 15 Sep 2014 12:03:05 -0400 Subject: [PATCH] go/loader: clarify the nocgo check. LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/144910043 --- go/loader/stdlib_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/go/loader/stdlib_test.go b/go/loader/stdlib_test.go index 21a48b4669..69942645eb 100644 --- a/go/loader/stdlib_test.go +++ b/go/loader/stdlib_test.go @@ -120,8 +120,10 @@ func TestCgoOption(t *testing.T) { case "plan9", "solaris", "windows": return } - // For linux-amd64-nocgo, cgo is not used. - if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" && !build.Default.CgoEnabled { + // In nocgo builds (e.g. linux-amd64-nocgo), + // there is no "runtime/cgo" package, + // so cgo-generated Go files will have a failing import. + if !build.Default.CgoEnabled { return } // Test that we can load cgo-using packages with