Skip to content

Commit

Permalink
cmd/go: remove the -buildinfo flag
Browse files Browse the repository at this point in the history
Fixes golang#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>
  • Loading branch information
Bryan C. Mills authored and jproberts committed Jun 21, 2022
1 parent 14b8311 commit 8cc7f4e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 16 deletions.
7 changes: 1 addition & 6 deletions src/cmd/go/alldocs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cmd/go/go_test.go
Expand Up @@ -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")
}
Expand Down
1 change: 0 additions & 1 deletion src/cmd/go/internal/cfg/cfg.go
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/load/pkg.go
Expand Up @@ -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")
}
Expand Down
8 changes: 1 addition & 7 deletions src/cmd/go/internal/work/build.go
Expand Up @@ -88,19 +88,14 @@ 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
Whether to stamp binaries with version control information. By default,
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'
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8cc7f4e

Please sign in to comment.