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 <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Bryan C. Mills 2022-01-14 11:23:59 -05:00 committed by Bryan Mills
parent 5b3ebc8b72
commit d54f663070
5 changed files with 4 additions and 16 deletions

View File

@ -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'

View File

@ -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")
}

View File

@ -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()

View File

@ -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")
}

View File

@ -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.