From d54f6630703900948d9757487a1bffd87b7d36e2 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 14 Jan 2022 11:23:59 -0500 Subject: [PATCH] cmd/go: remove the -buildinfo flag Fixes #50501 (in a sense, by removing a flag that looks like it should do something it does not) Change-Id: I69ae4862706a6283cda4016fd43b361bb21557f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/378576 Trust: Bryan Mills Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Russ Cox --- src/cmd/go/alldocs.go | 7 +------ src/cmd/go/go_test.go | 2 +- src/cmd/go/internal/cfg/cfg.go | 1 - src/cmd/go/internal/load/pkg.go | 2 +- src/cmd/go/internal/work/build.go | 8 +------- 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 3bb9d146b21ae..1d3098a76e459 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -135,11 +135,6 @@ // // -asmflags '[pattern=]arg list' // arguments to pass on each go tool asm invocation. -// -buildinfo -// Whether to stamp binaries with build flags. By default, the compiler name -// (gc or gccgo), toolchain flags (like -gcflags), and environment variables -// containing flags (like CGO_CFLAGS) are stamped into binaries. Use -// -buildinfo=false to omit build information. See also -buildvcs. // -buildmode mode // build mode to use. See 'go help buildmode' for more. // -buildvcs @@ -147,7 +142,7 @@ // version control information is stamped into a binary if the main package // and the main module containing it are in the repository containing the // current directory (if there is a repository). Use -buildvcs=false to -// omit version control information. See also -buildinfo. +// omit version control information. // -compiler name // name of compiler to use, as in runtime.Compiler (gccgo or gc). // -gccgoflags '[pattern=]arg list' diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 170c882df9e77..7aaec4eb9864e 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -1387,7 +1387,7 @@ func TestLdFlagsLongArgumentsIssue42295(t *testing.T) { for buf.Len() < sys.ExecArgLengthLimit+1 { buf.WriteString(testStr) } - tg.run("run", "-buildinfo=false", "-ldflags", fmt.Sprintf(`-X "main.extern=%s"`, buf.String()), tg.path("main.go")) + tg.run("run", "-ldflags", fmt.Sprintf(`-X "main.extern=%s"`, buf.String()), tg.path("main.go")) if tg.stderr.String() != buf.String() { t.Errorf("strings differ") } diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go index 5b84d8be92117..7f68d7bb62839 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go @@ -25,7 +25,6 @@ import ( // These are general "build flags" used by build and other commands. var ( BuildA bool // -a flag - BuildBuildinfo bool // -buildinfo flag BuildBuildmode string // -buildmode flag BuildBuildvcs bool // -buildvcs flag BuildContext = defaultContext() diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index a891d601b1d4f..fca9d5a0a296c 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -2292,7 +2292,7 @@ func (p *Package) setBuildInfo() { // Add command-line flags relevant to the build. // This is informational, not an exhaustive list. // Please keep the list sorted. - if cfg.BuildBuildinfo && !p.Standard { + if !p.Standard { if cfg.BuildASan { appendSetting("-asan", "true") } diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index 9b1acf987d056..56648338c553c 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -88,11 +88,6 @@ and test commands: -asmflags '[pattern=]arg list' arguments to pass on each go tool asm invocation. - -buildinfo - Whether to stamp binaries with build flags. By default, the compiler name - (gc or gccgo), toolchain flags (like -gcflags), and environment variables - containing flags (like CGO_CFLAGS) are stamped into binaries. Use - -buildinfo=false to omit build information. See also -buildvcs. -buildmode mode build mode to use. See 'go help buildmode' for more. -buildvcs @@ -100,7 +95,7 @@ and test commands: version control information is stamped into a binary if the main package and the main module containing it are in the repository containing the current directory (if there is a repository). Use -buildvcs=false to - omit version control information. See also -buildinfo. + omit version control information. -compiler name name of compiler to use, as in runtime.Compiler (gccgo or gc). -gccgoflags '[pattern=]arg list' @@ -317,7 +312,6 @@ func AddBuildFlags(cmd *base.Command, mask BuildFlagMask) { cmd.Flag.Var((*base.StringsFlag)(&cfg.BuildToolexec), "toolexec", "") cmd.Flag.BoolVar(&cfg.BuildTrimpath, "trimpath", false, "") cmd.Flag.BoolVar(&cfg.BuildWork, "work", false, "") - cmd.Flag.BoolVar(&cfg.BuildBuildinfo, "buildinfo", true, "") cmd.Flag.BoolVar(&cfg.BuildBuildvcs, "buildvcs", true, "") // Undocumented, unstable debugging flags.