From 24bf8f62be681f5c2d23b8faf2816bc48ea81ace Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 13 Dec 2014 08:48:44 -0800 Subject: [PATCH] cmd/go: gc never permits C files; gccgo always does Change-Id: I513665626ec0866f32036c26207dc234c17acea1 Reviewed-on: https://go-review.googlesource.com/1540 Reviewed-by: Brad Fitzpatrick Reviewed-by: Minux Ma --- src/cmd/go/pkg.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go index b71feb7a67f..23154f91207 100644 --- a/src/cmd/go/pkg.go +++ b/src/cmd/go/pkg.go @@ -629,9 +629,8 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package } p.Target = p.target - // Check for C code compiled with Plan 9 C compiler. - // No longer allowed except in runtime and runtime/cgo, for now. - if len(p.CFiles) > 0 && !p.usesCgo() && (!p.Standard || p.ImportPath != "runtime") { + // The gc toolchain only permits C source files with cgo. + if len(p.CFiles) > 0 && !p.usesCgo() && buildContext.Compiler == "gc" { p.Error = &PackageError{ ImportStack: stk.copy(), Err: fmt.Sprintf("C source files not allowed when not using cgo: %s", strings.Join(p.CFiles, " ")),