From 414c58174b76adf22c783d04ace5e5caa326de2e Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 27 Jul 2017 12:55:07 +0200 Subject: [PATCH] build: Move -installsuffix behind an explicit option (fixes #4272) --- build.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.go b/build.go index f2d32d890..d8e7f0057 100644 --- a/build.go +++ b/build.go @@ -44,6 +44,7 @@ var ( debug = os.Getenv("BUILDDEBUG") != "" noBuildGopath bool extraTags string + installSuffix string ) type target struct { @@ -340,6 +341,7 @@ func parseFlags() { flag.BoolVar(&race, "race", race, "Use race detector") flag.BoolVar(&noBuildGopath, "no-build-gopath", noBuildGopath, "Don't build GOPATH, assume it's OK") flag.StringVar(&extraTags, "tags", extraTags, "Extra tags, space separated") + flag.StringVar(&installSuffix, "installsuffix", installSuffix, "Install suffix, optional") flag.Parse() } @@ -404,7 +406,9 @@ func install(target target, tags []string) { args := []string{"install", "-v", "-ldflags", ldflags()} if len(tags) > 0 { args = append(args, "-tags", strings.Join(tags, " ")) - args = append(args, "-installsuffix", strings.Join(tags, "-")) + } + if installSuffix != "" { + args = append(args, "-installsuffix", installSuffix) } if race { args = append(args, "-race") @@ -425,7 +429,9 @@ func build(target target, tags []string) { args := []string{"build", "-i", "-v", "-ldflags", ldflags()} if len(tags) > 0 { args = append(args, "-tags", strings.Join(tags, " ")) - args = append(args, "-installsuffix", strings.Join(tags, "-")) + } + if installSuffix != "" { + args = append(args, "-installsuffix", installSuffix) } if race { args = append(args, "-race")