Skip to content

Commit

Permalink
go/build: don't alter InstallSuffix for default compile options
Browse files Browse the repository at this point in the history
Fixes #16378.

Change-Id: I99a064f1afec78fb63cb3719061d20be0f21d45d
Reviewed-on: https://go-review.googlesource.com/24930
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
josharian committed Aug 26, 2016
1 parent 8706105 commit a46ea90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions misc/cgo/testshared/shared_test.go
Expand Up @@ -43,7 +43,7 @@ func run(t *testing.T, msg string, args ...string) {
}

// goCmd invokes the go tool with the installsuffix set up by TestMain. It calls
// t.Errorf if the command fails.
// t.Fatalf if the command fails.
func goCmd(t *testing.T, args ...string) {
newargs := []string{args[0], "-installsuffix=" + suffix}
if testing.Verbose() {
Expand All @@ -63,7 +63,7 @@ func goCmd(t *testing.T, args ...string) {
}
if err != nil {
if t != nil {
t.Errorf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, output)
t.Fatalf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, output)
} else {
log.Fatalf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, output)
}
Expand Down
9 changes: 6 additions & 3 deletions src/cmd/go/build.go
Expand Up @@ -431,10 +431,13 @@ func buildModeInit() {
buildAsmflags = append(buildAsmflags, codegenArg)
buildGcflags = append(buildGcflags, codegenArg)
}
if buildContext.InstallSuffix != "" {
buildContext.InstallSuffix += "_"
// Don't alter InstallSuffix when modifying default codegen args.
if buildBuildmode != "default" || buildLinkshared {
if buildContext.InstallSuffix != "" {
buildContext.InstallSuffix += "_"
}
buildContext.InstallSuffix += codegenArg[1:]
}
buildContext.InstallSuffix += codegenArg[1:]
}
}

Expand Down

0 comments on commit a46ea90

Please sign in to comment.