]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/api: fix tool for recent go/build change
authorRuss Cox <rsc@golang.org>
Wed, 11 Sep 2013 18:42:34 +0000 (14:42 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 11 Sep 2013 18:42:34 +0000 (14:42 -0400)
Asking about runtime/cgo when CgoEnabled=false now correctly
returns an error from build.Import (specifically, NoGoError), because
there are no buildable Go files in that directory.

The API tool was depending on it returning a package with no Go
files instead. Correct that assumption.

Fixes all.bash on local machines.
(Dashboard appears not to be running the api tool at all.)

Update #6124

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/13385046

src/cmd/api/goapi.go

index 7102e9d409af21086e57beefb88d90cb8b12626e..a62c87421032c1bcd1237aeb3f1a895c74078b7c 100644 (file)
@@ -145,6 +145,10 @@ func main() {
                        //   going to change w/o a language change.
                        // - We don't care about the API of commands.
                        if name != "unsafe" && !strings.HasPrefix(name, "cmd/") {
+                               if name == "runtime/cgo" && !context.CgoEnabled {
+                                       // w.Import(name) will return nil
+                                       continue
+                               }
                                w.export(w.Import(name))
                        }
                }