diff --git a/src/cmd/go/internal/par/bench_test.go b/src/cmd/go/internal/cfg/bench_test.go similarity index 94% rename from src/cmd/go/internal/par/bench_test.go rename to src/cmd/go/internal/cfg/bench_test.go index 568c1ebe0c7a30..31a00f7e5fa5ea 100644 --- a/src/cmd/go/internal/par/bench_test.go +++ b/src/cmd/go/internal/cfg/bench_test.go @@ -1,4 +1,4 @@ -package par +package cfg import ( "testing" diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go index c8e33f21d3b078..7d54771bddd5c6 100644 --- a/src/cmd/go/internal/cfg/cfg.go +++ b/src/cmd/go/internal/cfg/cfg.go @@ -21,7 +21,6 @@ import ( "sync" "cmd/go/internal/fsys" - "cmd/go/internal/par" ) // Global build parameters (used during package load) @@ -161,7 +160,7 @@ func defaultContext() build.Context { if ctxt.CgoEnabled { if os.Getenv("CC") == "" { cc := DefaultCC(ctxt.GOOS, ctxt.GOARCH) - if _, err := par.LookPath(cc); err != nil { + if _, err := LookPath(cc); err != nil { ctxt.CgoEnabled = false } } diff --git a/src/cmd/go/internal/par/lookpath.go b/src/cmd/go/internal/cfg/lookpath.go similarity index 98% rename from src/cmd/go/internal/par/lookpath.go rename to src/cmd/go/internal/cfg/lookpath.go index 6fa4a1dc53f1dc..13f30be6598d09 100644 --- a/src/cmd/go/internal/par/lookpath.go +++ b/src/cmd/go/internal/cfg/lookpath.go @@ -1,4 +1,4 @@ -package par +package cfg import ( "os/exec" diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index 50990bbe5a3273..14197814eedfbe 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -26,7 +26,6 @@ import ( "cmd/go/internal/cfg" "cmd/go/internal/load" "cmd/go/internal/modload" - "cmd/go/internal/par" "cmd/go/internal/str" "cmd/go/internal/work" ) @@ -480,7 +479,7 @@ func (g *Generator) exec(words []string) { // intends to use the same 'go' as 'go generate' itself. // Prefer to resolve the binary from GOROOT/bin, and for consistency // prefer to resolve any other commands there too. - gorootBinPath, err := par.LookPath(filepath.Join(cfg.GOROOTbin, path)) + gorootBinPath, err := cfg.LookPath(filepath.Join(cfg.GOROOTbin, path)) if err == nil { path = gorootBinPath } diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index a0b69000d44fee..a899b64d5b40d9 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -2479,7 +2479,7 @@ func (p *Package) setBuildInfo(ctx context.Context, autoVCS bool) { goto omitVCS } if cfg.BuildBuildvcs == "auto" && vcsCmd != nil && vcsCmd.Cmd != "" { - if _, err := par.LookPath(vcsCmd.Cmd); err != nil { + if _, err := cfg.LookPath(vcsCmd.Cmd); err != nil { // We fould a repository, but the required VCS tool is not present. // "-buildvcs=auto" means that we should silently drop the VCS metadata. goto omitVCS diff --git a/src/cmd/go/internal/script/cmds.go b/src/cmd/go/internal/script/cmds.go index 6cfc6e1dcc80ae..ecd35ff8b122c1 100644 --- a/src/cmd/go/internal/script/cmds.go +++ b/src/cmd/go/internal/script/cmds.go @@ -5,7 +5,7 @@ package script import ( - "cmd/go/internal/par" + "cmd/go/internal/cfg" "cmd/go/internal/robustio" "errors" "fmt" @@ -825,7 +825,7 @@ func Program(name string, cancel func(*exec.Cmd) error, waitDelay time.Duration) }, func(s *State, args ...string) (WaitFunc, error) { lookPathOnce.Do(func() { - path, pathErr = par.LookPath(name) + path, pathErr = cfg.LookPath(name) }) if pathErr != nil { return nil, pathErr diff --git a/src/cmd/go/internal/script/scripttest/scripttest.go b/src/cmd/go/internal/script/scripttest/scripttest.go index 714dd320268daa..6d7bd7863b9f42 100644 --- a/src/cmd/go/internal/script/scripttest/scripttest.go +++ b/src/cmd/go/internal/script/scripttest/scripttest.go @@ -7,7 +7,7 @@ package scripttest import ( "bufio" - "cmd/go/internal/par" + "cmd/go/internal/cfg" "cmd/go/internal/script" "errors" "io" @@ -137,7 +137,7 @@ func CachedExec() script.Cond { return script.CachedCondition( " names an executable in the test binary's PATH", func(name string) (bool, error) { - _, err := par.LookPath(name) + _, err := cfg.LookPath(name) return err == nil, nil }) } diff --git a/src/cmd/go/internal/toolchain/select.go b/src/cmd/go/internal/toolchain/select.go index 1ae08299ae3868..c3985dedc64620 100644 --- a/src/cmd/go/internal/toolchain/select.go +++ b/src/cmd/go/internal/toolchain/select.go @@ -23,7 +23,6 @@ import ( "cmd/go/internal/gover" "cmd/go/internal/modfetch" "cmd/go/internal/modload" - "cmd/go/internal/par" "cmd/go/internal/run" "golang.org/x/mod/module" @@ -283,7 +282,7 @@ func Exec(gotoolchain string) { // Look in PATH for the toolchain before we download one. // This allows custom toolchains as well as reuse of toolchains // already installed using go install golang.org/dl/go1.2.3@latest. - if exe, err := par.LookPath(gotoolchain); err == nil { + if exe, err := cfg.LookPath(gotoolchain); err == nil { execGoToolchain(gotoolchain, "", exe) } diff --git a/src/cmd/go/internal/vcs/vcs.go b/src/cmd/go/internal/vcs/vcs.go index a6ead9ec73728e..d10f1d29d83123 100644 --- a/src/cmd/go/internal/vcs/vcs.go +++ b/src/cmd/go/internal/vcs/vcs.go @@ -24,7 +24,6 @@ import ( "cmd/go/internal/base" "cmd/go/internal/cfg" - "cmd/go/internal/par" "cmd/go/internal/search" "cmd/go/internal/str" "cmd/go/internal/web" @@ -681,7 +680,7 @@ func (v *Cmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([ args = args[2:] } - _, err := par.LookPath(v.Cmd) + _, err := cfg.LookPath(v.Cmd) if err != nil { fmt.Fprintf(os.Stderr, "go: missing %s command. See https://golang.org/s/gogetcmd\n", diff --git a/src/cmd/go/internal/vcweb/fossil.go b/src/cmd/go/internal/vcweb/fossil.go index b84736107c93f3..472689edb6fa0b 100644 --- a/src/cmd/go/internal/vcweb/fossil.go +++ b/src/cmd/go/internal/vcweb/fossil.go @@ -5,7 +5,7 @@ package vcweb import ( - "cmd/go/internal/par" + "cmd/go/internal/cfg" "fmt" "log" "net/http" @@ -23,7 +23,7 @@ type fossilHandler struct { func (h *fossilHandler) Available() bool { h.once.Do(func() { - h.fossilPath, h.fossilPathErr = par.LookPath("fossil") + h.fossilPath, h.fossilPathErr = cfg.LookPath("fossil") }) return h.fossilPathErr == nil } diff --git a/src/cmd/go/internal/vcweb/git.go b/src/cmd/go/internal/vcweb/git.go index 01d70556259ec0..98f378d8b5a8c4 100644 --- a/src/cmd/go/internal/vcweb/git.go +++ b/src/cmd/go/internal/vcweb/git.go @@ -5,7 +5,7 @@ package vcweb import ( - "cmd/go/internal/par" + "cmd/go/internal/cfg" "log" "net/http" "net/http/cgi" @@ -27,7 +27,7 @@ func (h *gitHandler) Available() bool { return false } h.once.Do(func() { - h.gitPath, h.gitPathErr = par.LookPath("git") + h.gitPath, h.gitPathErr = cfg.LookPath("git") }) return h.gitPathErr == nil } diff --git a/src/cmd/go/internal/vcweb/hg.go b/src/cmd/go/internal/vcweb/hg.go index 6c877cfad4a2df..40e91fd20950da 100644 --- a/src/cmd/go/internal/vcweb/hg.go +++ b/src/cmd/go/internal/vcweb/hg.go @@ -6,7 +6,7 @@ package vcweb import ( "bufio" - "cmd/go/internal/par" + "cmd/go/internal/cfg" "context" "errors" "io" @@ -30,7 +30,7 @@ type hgHandler struct { func (h *hgHandler) Available() bool { h.once.Do(func() { - h.hgPath, h.hgPathErr = par.LookPath("hg") + h.hgPath, h.hgPathErr = cfg.LookPath("hg") }) return h.hgPathErr == nil } diff --git a/src/cmd/go/internal/vcweb/svn.go b/src/cmd/go/internal/vcweb/svn.go index 065484ea6614cb..55361c2afacb43 100644 --- a/src/cmd/go/internal/vcweb/svn.go +++ b/src/cmd/go/internal/vcweb/svn.go @@ -5,7 +5,7 @@ package vcweb import ( - "cmd/go/internal/par" + "cmd/go/internal/cfg" "io" "log" "net" @@ -55,7 +55,7 @@ type svnState struct { func (h *svnHandler) Available() bool { h.pathOnce.Do(func() { - h.svnservePath, h.svnserveErr = par.LookPath("svnserve") + h.svnservePath, h.svnserveErr = cfg.LookPath("svnserve") }) return h.svnserveErr == nil } diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index 3f725f05a01e1c..0f9c2b358072c3 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -21,7 +21,6 @@ import ( "cmd/go/internal/fsys" "cmd/go/internal/load" "cmd/go/internal/modload" - "cmd/go/internal/par" "cmd/go/internal/search" "cmd/go/internal/trace" ) @@ -898,7 +897,7 @@ func FindExecCmd() []string { if cfg.Goos == runtime.GOOS && cfg.Goarch == runtime.GOARCH { return ExecCmd } - path, err := par.LookPath(fmt.Sprintf("go_%s_%s_exec", cfg.Goos, cfg.Goarch)) + path, err := cfg.LookPath(fmt.Sprintf("go_%s_%s_exec", cfg.Goos, cfg.Goarch)) if err == nil { ExecCmd = []string{path} } diff --git a/src/cmd/go/internal/work/buildid.go b/src/cmd/go/internal/work/buildid.go index f52497e78a1663..953d4679cd0125 100644 --- a/src/cmd/go/internal/work/buildid.go +++ b/src/cmd/go/internal/work/buildid.go @@ -15,7 +15,6 @@ import ( "cmd/go/internal/cache" "cmd/go/internal/cfg" "cmd/go/internal/fsys" - "cmd/go/internal/par" "cmd/go/internal/str" "cmd/internal/buildid" "cmd/internal/quoted" @@ -271,7 +270,7 @@ func (b *Builder) gccToolID(name, language string) (id, exe string, err error) { } exe = fields[0] if !strings.ContainsAny(exe, `/\`) { - if lp, err := par.LookPath(exe); err == nil { + if lp, err := cfg.LookPath(exe); err == nil { exe = lp } } diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index bec6751068950b..1d7ec0bf5d897b 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -39,7 +39,6 @@ import ( "cmd/go/internal/gover" "cmd/go/internal/load" "cmd/go/internal/modload" - "cmd/go/internal/par" "cmd/go/internal/str" "cmd/go/internal/trace" "cmd/internal/buildid" @@ -2374,7 +2373,7 @@ func (b *Builder) runOut(a *Action, dir string, env []string, cmdargs ...any) ([ } var buf bytes.Buffer - path, err := par.LookPath(cmdline[0]) + path, err := cfg.LookPath(cmdline[0]) if err != nil { return nil, err } @@ -3018,7 +3017,7 @@ func (b *Builder) gccCompilerID(compiler string) (id cache.ActionID, ok bool) { // // Otherwise, we compute a new validation description // and compiler id (below). - exe, err := par.LookPath(compiler) + exe, err := cfg.LookPath(compiler) if err != nil { return cache.ActionID{}, false } diff --git a/src/cmd/go/internal/work/gccgo.go b/src/cmd/go/internal/work/gccgo.go index e38d06a89bcc5a..8893d57ff7e734 100644 --- a/src/cmd/go/internal/work/gccgo.go +++ b/src/cmd/go/internal/work/gccgo.go @@ -16,7 +16,6 @@ import ( "cmd/go/internal/cfg" "cmd/go/internal/fsys" "cmd/go/internal/load" - "cmd/go/internal/par" "cmd/go/internal/str" "cmd/internal/pkgpath" ) @@ -33,7 +32,7 @@ func init() { if GccgoName == "" { GccgoName = "gccgo" } - GccgoBin, gccgoErr = par.LookPath(GccgoName) + GccgoBin, gccgoErr = cfg.LookPath(GccgoName) } func (gccgoToolchain) compiler() string {