]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove some unused parameters
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 16 Mar 2018 13:10:14 +0000 (14:10 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Fri, 16 Mar 2018 21:01:28 +0000 (21:01 +0000)
Change-Id: I441b3045e76afc1c561914926c14efc8a116c8a7
Reviewed-on: https://go-review.googlesource.com/101195
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/internal/work/build_test.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/go/internal/work/gccgo.go

index 3f5ba37c64122d90b6cafc6ba860c83a1775f2e5..ca2d0bb137cd7e12045311c07ff83f4fe775836f 100644 (file)
@@ -220,7 +220,7 @@ func TestRespectSetgidDir(t *testing.T) {
        defer pkgfile.Close()
 
        dirGIDFile := filepath.Join(setgiddir, "setgid")
-       if err := b.moveOrCopyFile(nil, dirGIDFile, pkgfile.Name(), 0666, true); err != nil {
+       if err := b.moveOrCopyFile(dirGIDFile, pkgfile.Name(), 0666, true); err != nil {
                t.Fatalf("moveOrCopyFile: %v", err)
        }
 
index e61d6d5cc4dc30264954fa9d979959b86e0a0030..ee1eac8040d3a3786879da2a87a5496e5414952a 100644 (file)
@@ -432,7 +432,7 @@ func (b *Builder) build(a *Action) (err error) {
                                // Not covering this file.
                                continue
                        }
-                       if err := b.cover(a, coverFile, sourceFile, 0666, cover.Var); err != nil {
+                       if err := b.cover(a, coverFile, sourceFile, cover.Var); err != nil {
                                return err
                        }
                        if i < len(gofiles) {
@@ -596,17 +596,17 @@ func (b *Builder) build(a *Action) (err error) {
                switch {
                case strings.HasSuffix(name, _goos_goarch):
                        targ := file[:len(name)-len(_goos_goarch)] + "_GOOS_GOARCH." + ext
-                       if err := b.copyFile(a, objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
+                       if err := b.copyFile(objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
                                return err
                        }
                case strings.HasSuffix(name, _goarch):
                        targ := file[:len(name)-len(_goarch)] + "_GOARCH." + ext
-                       if err := b.copyFile(a, objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
+                       if err := b.copyFile(objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
                                return err
                        }
                case strings.HasSuffix(name, _goos):
                        targ := file[:len(name)-len(_goos)] + "_GOOS." + ext
-                       if err := b.copyFile(a, objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
+                       if err := b.copyFile(objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
                                return err
                        }
                }
@@ -954,7 +954,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
                        }
                }
                var out []byte
-               out, err = b.runOut(p.Dir, p.ImportPath, nil, b.PkgconfigCmd(), "--cflags", pcflags, "--", pkgs)
+               out, err = b.runOut(p.Dir, nil, b.PkgconfigCmd(), "--cflags", pcflags, "--", pkgs)
                if err != nil {
                        b.showOutput(nil, p.Dir, b.PkgconfigCmd()+" --cflags "+strings.Join(pcflags, " ")+strings.Join(pkgs, " "), string(out))
                        b.Print(err.Error() + "\n")
@@ -966,7 +966,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
                                return nil, nil, err
                        }
                }
-               out, err = b.runOut(p.Dir, p.ImportPath, nil, b.PkgconfigCmd(), "--libs", pcflags, "--", pkgs)
+               out, err = b.runOut(p.Dir, nil, b.PkgconfigCmd(), "--libs", pcflags, "--", pkgs)
                if err != nil {
                        b.showOutput(nil, p.Dir, b.PkgconfigCmd()+" --libs "+strings.Join(pcflags, " ")+strings.Join(pkgs, " "), string(out))
                        b.Print(err.Error() + "\n")
@@ -1126,7 +1126,7 @@ func BuildInstallFunc(b *Builder, a *Action) (err error) {
 
        defer b.cleanup(a1)
 
-       return b.moveOrCopyFile(a, a.Target, a1.built, perm, false)
+       return b.moveOrCopyFile(a.Target, a1.built, perm, false)
 }
 
 // cleanup removes a's object dir to keep the amount of
@@ -1143,7 +1143,7 @@ func (b *Builder) cleanup(a *Action) {
 }
 
 // moveOrCopyFile is like 'mv src dst' or 'cp src dst'.
-func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, force bool) error {
+func (b *Builder) moveOrCopyFile(dst, src string, perm os.FileMode, force bool) error {
        if cfg.BuildN {
                b.Showcmd("", "mv %s %s", src, dst)
                return nil
@@ -1154,7 +1154,7 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
 
        // If the source is in the build cache, we need to copy it.
        if strings.HasPrefix(src, cache.DefaultDir()) {
-               return b.copyFile(a, dst, src, perm, force)
+               return b.copyFile(dst, src, perm, force)
        }
 
        // On Windows, always copy the file, so that we respect the NTFS
@@ -1162,7 +1162,7 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
        // What matters here is not cfg.Goos (the system we are building
        // for) but runtime.GOOS (the system we are building on).
        if runtime.GOOS == "windows" {
-               return b.copyFile(a, dst, src, perm, force)
+               return b.copyFile(dst, src, perm, force)
        }
 
        // If the destination directory has the group sticky bit set,
@@ -1170,7 +1170,7 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
        // https://golang.org/issue/18878
        if fi, err := os.Stat(filepath.Dir(dst)); err == nil {
                if fi.IsDir() && (fi.Mode()&os.ModeSetgid) != 0 {
-                       return b.copyFile(a, dst, src, perm, force)
+                       return b.copyFile(dst, src, perm, force)
                }
        }
 
@@ -1200,11 +1200,11 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
                }
        }
 
-       return b.copyFile(a, dst, src, perm, force)
+       return b.copyFile(dst, src, perm, force)
 }
 
 // copyFile is like 'cp src dst'.
-func (b *Builder) copyFile(a *Action, dst, src string, perm os.FileMode, force bool) error {
+func (b *Builder) copyFile(dst, src string, perm os.FileMode, force bool) error {
        if cfg.BuildN || cfg.BuildX {
                b.Showcmd("", "cp %s %s", src, dst)
                if cfg.BuildN {
@@ -1295,12 +1295,12 @@ func (b *Builder) installHeader(a *Action) error {
                }
        }
 
-       return b.moveOrCopyFile(a, a.Target, src, 0666, true)
+       return b.moveOrCopyFile(a.Target, src, 0666, true)
 }
 
 // cover runs, in effect,
 //     go tool cover -mode=b.coverMode -var="varName" -o dst.go src.go
-func (b *Builder) cover(a *Action, dst, src string, perm os.FileMode, varName string) error {
+func (b *Builder) cover(a *Action, dst, src string, varName string) error {
        return b.run(a, a.Objdir, "cover "+a.Package.ImportPath, nil,
                cfg.BuildToolexec,
                base.Tool("cover"),
@@ -1447,7 +1447,7 @@ var cgoTypeSigRe = regexp.MustCompile(`\b_C2?(type|func|var|macro)_\B`)
 // If the command fails, run prints information about the failure
 // and returns a non-nil error.
 func (b *Builder) run(a *Action, dir string, desc string, env []string, cmdargs ...interface{}) error {
-       out, err := b.runOut(dir, desc, env, cmdargs...)
+       out, err := b.runOut(dir, env, cmdargs...)
        if len(out) > 0 {
                if desc == "" {
                        desc = b.fmtcmd(dir, "%s", strings.Join(str.StringList(cmdargs...), " "))
@@ -1479,7 +1479,7 @@ func (b *Builder) processOutput(out []byte) string {
 
 // runOut runs the command given by cmdline in the directory dir.
 // It returns the command output and any errors that occurred.
-func (b *Builder) runOut(dir string, desc string, env []string, cmdargs ...interface{}) ([]byte, error) {
+func (b *Builder) runOut(dir string, env []string, cmdargs ...interface{}) ([]byte, error) {
        cmdline := str.StringList(cmdargs...)
 
        for _, arg := range cmdline {
@@ -1691,7 +1691,7 @@ func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []s
        if !filepath.IsAbs(outfile) {
                outfile = filepath.Join(p.Dir, outfile)
        }
-       output, err := b.runOut(filepath.Dir(file), desc, nil, compiler, flags, "-o", outfile, "-c", filepath.Base(file))
+       output, err := b.runOut(filepath.Dir(file), nil, compiler, flags, "-o", outfile, "-c", filepath.Base(file))
        if len(output) > 0 {
                // On FreeBSD 11, when we pass -g to clang 3.8 it
                // invokes its internal assembler with -dwarf-version=2.
@@ -2215,7 +2215,7 @@ var (
 )
 
 func (b *Builder) swigDoVersionCheck() error {
-       out, err := b.runOut("", "", nil, "swig", "-version")
+       out, err := b.runOut("", nil, "swig", "-version")
        if err != nil {
                return err
        }
@@ -2370,7 +2370,7 @@ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFL
                args = append(args, "-c++")
        }
 
-       out, err := b.runOut(p.Dir, p.ImportPath, nil, "swig", args, file)
+       out, err := b.runOut(p.Dir, nil, "swig", args, file)
        if err != nil {
                if len(out) > 0 {
                        if bytes.Contains(out, []byte("-intgosize")) || bytes.Contains(out, []byte("-cgo")) {
index 1fef7071340e9fdef3665258cc4fd9f795db1fc6..3ccc2c1d147f78ef341967e4e0bb442e1db307e1 100644 (file)
@@ -128,7 +128,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, a
                args = append(args, mkAbs(p.Dir, f))
        }
 
-       output, err = b.runOut(p.Dir, p.ImportPath, nil, args...)
+       output, err = b.runOut(p.Dir, nil, args...)
        return ofile, output, err
 }
 
@@ -289,14 +289,14 @@ func (gcToolchain) pack(b *Builder, a *Action, afile string, ofiles []string) er
        if cfg.BuildN {
                return nil
        }
-       if err := packInternal(b, absAfile, absOfiles); err != nil {
+       if err := packInternal(absAfile, absOfiles); err != nil {
                b.showOutput(a, p.Dir, p.ImportPath, err.Error()+"\n")
                return errPrintedOutput
        }
        return nil
 }
 
-func packInternal(b *Builder, afile string, ofiles []string) error {
+func packInternal(afile string, ofiles []string) error {
        dst, err := os.OpenFile(afile, os.O_WRONLY|os.O_APPEND, 0)
        if err != nil {
                return err
index 2512ffeda4fee38ea3975c720fc5822376aeb86d..91daf529d4111a574bead39ce036de30638f85e1 100644 (file)
@@ -85,7 +85,7 @@ func (tools gccgoToolchain) gc(b *Builder, a *Action, archive string, importcfg
                args = append(args, mkAbs(p.Dir, f))
        }
 
-       output, err = b.runOut(p.Dir, p.ImportPath, nil, args)
+       output, err = b.runOut(p.Dir, nil, args)
        return ofile, output, err
 }
 
@@ -232,7 +232,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
        readAndRemoveCgoFlags := func(archive string) (string, error) {
                newID++
                newArchive := root.Objdir + fmt.Sprintf("_pkg%d_.a", newID)
-               if err := b.copyFile(root, newArchive, archive, 0666, false); err != nil {
+               if err := b.copyFile(newArchive, archive, 0666, false); err != nil {
                        return "", err
                }
                if cfg.BuildN || cfg.BuildX {