]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: rename ld, ldShared "out" argument to "targetPath"
authorAustin Clements <austin@google.com>
Wed, 11 Oct 2023 16:31:55 +0000 (12:31 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 17 Oct 2023 17:30:34 +0000 (17:30 +0000)
"out" is often used for stdout or stderr. Rename it to targetPath to
clarify its meaning.

Change-Id: I95823e9119843a7026dc26c192497776ee4219e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/534595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Austin Clements <austin@google.com>

src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/go/internal/work/gccgo.go

index 42ecac6d03347a56aa3489717c5606b2b8b6e976..89e67314dfc6d491d368d16130ac294d34e16fa6 100644 (file)
@@ -2550,9 +2550,9 @@ type toolchain interface {
        // typically it is run in the object directory.
        pack(b *Builder, a *Action, afile string, ofiles []string) error
        // ld runs the linker to create an executable starting at mainpkg.
-       ld(b *Builder, root *Action, out, importcfg, mainpkg string) error
+       ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error
        // ldShared runs the linker to create a shared library containing the pkgs built by toplevelactions
-       ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error
+       ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error
 
        compiler() string
        linker() string
@@ -2591,11 +2591,11 @@ func (noToolchain) pack(b *Builder, a *Action, afile string, ofiles []string) er
        return noCompiler()
 }
 
-func (noToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) error {
+func (noToolchain) ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error {
        return noCompiler()
 }
 
-func (noToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error {
+func (noToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error {
        return noCompiler()
 }
 
index c2fed647c99eb82b8a509d4c64e8efc44a3538ff..3ea9f714d24222ebb2e697d85c7ca370230fb5a3 100644 (file)
@@ -572,7 +572,7 @@ func pluginPath(a *Action) string {
        return fmt.Sprintf("plugin/unnamed-%x", h.Sum(nil))
 }
 
-func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) error {
+func (gcToolchain) ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error {
        cxx := len(root.Package.CXXFiles) > 0 || len(root.Package.SwigCXXFiles) > 0
        for _, a := range root.Deps {
                if a.Package != nil && (len(a.Package.CXXFiles) > 0 || len(a.Package.SwigCXXFiles) > 0) {
@@ -641,17 +641,17 @@ func (gcToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string)
        // the output file path is recorded in the .gnu.version_d section.
        dir := "."
        if cfg.BuildBuildmode == "c-shared" || cfg.BuildBuildmode == "plugin" {
-               dir, out = filepath.Split(out)
+               dir, targetPath = filepath.Split(targetPath)
        }
 
        env := []string{}
        if cfg.BuildTrimpath {
                env = append(env, "GOROOT_FINAL="+trimPathGoRootFinal)
        }
-       return b.run(root, dir, root.Package.ImportPath, env, cfg.BuildToolexec, base.Tool("link"), "-o", out, "-importcfg", importcfg, ldflags, mainpkg)
+       return b.run(root, dir, root.Package.ImportPath, env, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags, mainpkg)
 }
 
-func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error {
+func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error {
        ldflags := []string{"-installsuffix", cfg.BuildContext.InstallSuffix}
        ldflags = append(ldflags, "-buildmode=shared")
        ldflags = append(ldflags, forcedLdflags...)
@@ -682,7 +682,7 @@ func (gcToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action,
                }
                ldflags = append(ldflags, d.Package.ImportPath+"="+d.Target)
        }
-       return b.run(root, ".", out, nil, cfg.BuildToolexec, base.Tool("link"), "-o", out, "-importcfg", importcfg, ldflags)
+       return b.run(root, ".", targetPath, nil, cfg.BuildToolexec, base.Tool("link"), "-o", targetPath, "-importcfg", importcfg, ldflags)
 }
 
 func (gcToolchain) cc(b *Builder, a *Action, ofile, cfile string) error {
index 0e9498988a93ab1339718e1ee8a991f6d1fcb10a..fa566bfd0593b690f744dc4e7c6cd54e1dca2ecf 100644 (file)
@@ -530,12 +530,12 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
        return nil
 }
 
-func (tools gccgoToolchain) ld(b *Builder, root *Action, out, importcfg, mainpkg string) error {
-       return tools.link(b, root, out, importcfg, root.Deps, ldBuildmode, root.Package.ImportPath)
+func (tools gccgoToolchain) ld(b *Builder, root *Action, targetPath, importcfg, mainpkg string) error {
+       return tools.link(b, root, targetPath, importcfg, root.Deps, ldBuildmode, root.Package.ImportPath)
 }
 
-func (tools gccgoToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, out, importcfg string, allactions []*Action) error {
-       return tools.link(b, root, out, importcfg, allactions, "shared", out)
+func (tools gccgoToolchain) ldShared(b *Builder, root *Action, toplevelactions []*Action, targetPath, importcfg string, allactions []*Action) error {
+       return tools.link(b, root, targetPath, importcfg, allactions, "shared", targetPath)
 }
 
 func (tools gccgoToolchain) cc(b *Builder, a *Action, ofile, cfile string) error {