From cd17032721425f1e131f3c19801c6e66972d4b6c Mon Sep 17 00:00:00 2001 From: qiulaidongfeng <2645477756@qq.com> Date: Wed, 21 Feb 2024 09:29:17 +0000 Subject: [PATCH] cmd/go: remove unused var BuildToolchainLinker and BuildToolchainCompiler Change-Id: I4bb855f6ada5c550a46f69313a2f47631bf657ca GitHub-Last-Rev: 2af07f9d7bda0de31b61d434635cd1c2c568af06 GitHub-Pull-Request: golang/go#65838 Reviewed-on: https://go-review.googlesource.com/c/go/+/565517 LUCI-TryBot-Result: Go LUCI Auto-Submit: Bryan Mills Reviewed-by: Bryan Mills Reviewed-by: Michael Matloob --- src/cmd/go/internal/cfg/cfg.go | 54 ++++++++++++++----------------- src/cmd/go/internal/work/build.go | 2 -- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go index 948bceab32f..58432335e41 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go @@ -64,33 +64,31 @@ func ToolExeSuffix() string { // These are general "build flags" used by build and other commands. var ( - BuildA bool // -a flag - BuildBuildmode string // -buildmode flag - BuildBuildvcs = "auto" // -buildvcs flag: "true", "false", or "auto" - BuildContext = defaultContext() - BuildMod string // -mod flag - BuildModExplicit bool // whether -mod was set explicitly - BuildModReason string // reason -mod was set, if set by default - BuildLinkshared bool // -linkshared flag - BuildMSan bool // -msan flag - BuildASan bool // -asan flag - BuildCover bool // -cover flag - BuildCoverMode string // -covermode flag - BuildCoverPkg []string // -coverpkg flag - BuildN bool // -n flag - BuildO string // -o flag - BuildP = runtime.GOMAXPROCS(0) // -p flag - BuildPGO string // -pgo flag - BuildPkgdir string // -pkgdir flag - BuildRace bool // -race flag - BuildToolexec []string // -toolexec flag - BuildToolchainName string - BuildToolchainCompiler func() string - BuildToolchainLinker func() string - BuildTrimpath bool // -trimpath flag - BuildV bool // -v flag - BuildWork bool // -work flag - BuildX bool // -x flag + BuildA bool // -a flag + BuildBuildmode string // -buildmode flag + BuildBuildvcs = "auto" // -buildvcs flag: "true", "false", or "auto" + BuildContext = defaultContext() + BuildMod string // -mod flag + BuildModExplicit bool // whether -mod was set explicitly + BuildModReason string // reason -mod was set, if set by default + BuildLinkshared bool // -linkshared flag + BuildMSan bool // -msan flag + BuildASan bool // -asan flag + BuildCover bool // -cover flag + BuildCoverMode string // -covermode flag + BuildCoverPkg []string // -coverpkg flag + BuildN bool // -n flag + BuildO string // -o flag + BuildP = runtime.GOMAXPROCS(0) // -p flag + BuildPGO string // -pgo flag + BuildPkgdir string // -pkgdir flag + BuildRace bool // -race flag + BuildToolexec []string // -toolexec flag + BuildToolchainName string + BuildTrimpath bool // -trimpath flag + BuildV bool // -v flag + BuildWork bool // -work flag + BuildX bool // -x flag ModCacheRW bool // -modcacherw flag ModFile string // -modfile flag @@ -181,8 +179,6 @@ func defaultContext() build.Context { func init() { SetGOROOT(Getenv("GOROOT"), false) - BuildToolchainCompiler = func() string { return "missing-compiler" } - BuildToolchainLinker = func() string { return "missing-linker" } } // SetGOROOT sets GOROOT and associated variables to the given values. diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index 408edb51193..ccfb4622e25 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -276,8 +276,6 @@ func (c buildCompiler) Set(value string) error { return fmt.Errorf("unknown compiler %q", value) } cfg.BuildToolchainName = value - cfg.BuildToolchainCompiler = BuildToolchain.compiler - cfg.BuildToolchainLinker = BuildToolchain.linker cfg.BuildContext.Compiler = value return nil }