]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: require -buildmode=c-shared to take one main package
authorRuss Cox <rsc@golang.org>
Thu, 22 Jun 2017 19:49:42 +0000 (15:49 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 23 Jun 2017 00:20:57 +0000 (00:20 +0000)
The current behavior is to filter out the non-main packages silently,
which is confusing if there are only non-main packages.
Instead, report an error unless it's used with a single main package.

To be clear, I don't really know what I'm doing.
It might be that multiple main packages are allowed, or even
that we do want the filtering, but all.bash passes with this change,
so I am taking that as a sign that we don't need that extra flexibility.

Fixes #15082.

Change-Id: I984d0f444a01c0ee0c3cd6646a75527ea99a9ebe
Reviewed-on: https://go-review.googlesource.com/46421
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/internal/work/build.go

index 20f3952d4a9de1b258795466c5219425f6d1ca53..a7949b6ff35a547623d443c7ecdac4185b2fa040 100644 (file)
@@ -288,7 +288,7 @@ func BuildModeInit() {
                cfg.ExeSuffix = ".a"
                ldBuildmode = "c-archive"
        case "c-shared":
-               pkgsFilter = pkgsMain
+               pkgsFilter = oneMainPkg
                if gccgo {
                        codegenArg = "-fPIC"
                } else {