aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/race/output_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2017-11-08 10:58:58 -0500
committerRuss Cox <rsc@golang.org>2017-11-09 15:04:04 +0000
commit5993251c015dfa1e905bdf44bdb41572387edf90 (patch)
tree04948dc09879e5058c534d519cb30ba57ead515f /src/runtime/race/output_test.go
parent98f1bfbb180b30e899b27ef5c5f53d16138dbd86 (diff)
downloadgo-5993251c015dfa1e905bdf44bdb41572387edf90.tar.gz
go-5993251c015dfa1e905bdf44bdb41572387edf90.zip
cmd/go: implement per-package asmflags, gcflags, ldflags, gccgoflags
It has always been problematic that there was no way to specify tool flags that applied only to the build of certain packages; it was only to specify flags for all packages being built. The usual workaround was to install all dependencies of something, then build just that one thing with different flags. Since the dependencies appeared to be up-to-date, they were not rebuilt with the different flags. The new content-based staleness (up-to-date) checks see through this trick, because they detect changes in flags. This forces us to address the underlying problem of providing a way to specify per-package flags. The solution is to allow -gcflags=pattern=flags, which means that flags apply to packages matching pattern, in addition to the usual -gcflags=flags, which is now redefined to apply only to the packages named on the command line. See #22527 for discussion and rationale. Fixes #22527. Change-Id: I6716bed69edc324767f707b5bbf3aaa90e8e7302 Reviewed-on: https://go-review.googlesource.com/76551 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/race/output_test.go')
-rw-r--r--src/runtime/race/output_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/race/output_test.go b/src/runtime/race/output_test.go
index 45c9afae23c..adf9ce8851e 100644
--- a/src/runtime/race/output_test.go
+++ b/src/runtime/race/output_test.go
@@ -24,7 +24,7 @@ func TestOutput(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(pkgdir)
- out, err := exec.Command(testenv.GoToolPath(t), "install", "-race", "-pkgdir="+pkgdir, "-gcflags=-l", "testing").CombinedOutput()
+ out, err := exec.Command(testenv.GoToolPath(t), "install", "-race", "-pkgdir="+pkgdir, "-gcflags=all=-l", "testing").CombinedOutput()
if err != nil {
t.Fatalf("go install -race: %v\n%s", err, out)
}
@@ -57,7 +57,7 @@ func TestOutput(t *testing.T) {
t.Fatalf("failed to close file: %v", err)
}
// Pass -l to the compiler to test stack traces.
- cmd := exec.Command(testenv.GoToolPath(t), test.run, "-race", "-pkgdir="+pkgdir, "-gcflags=-l", src)
+ cmd := exec.Command(testenv.GoToolPath(t), test.run, "-race", "-pkgdir="+pkgdir, "-gcflags=all=-l", src)
// GODEBUG spoils program output, GOMAXPROCS makes it flaky.
for _, env := range os.Environ() {
if strings.HasPrefix(env, "GODEBUG=") ||