Skip to content

Commit 2767c4e

Browse files
committed
cmd/go: remove some unused parameters
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>
1 parent b30bf95 commit 2767c4e

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

src/cmd/go/internal/work/build_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func TestRespectSetgidDir(t *testing.T) {
220220
defer pkgfile.Close()
221221

222222
dirGIDFile := filepath.Join(setgiddir, "setgid")
223-
if err := b.moveOrCopyFile(nil, dirGIDFile, pkgfile.Name(), 0666, true); err != nil {
223+
if err := b.moveOrCopyFile(dirGIDFile, pkgfile.Name(), 0666, true); err != nil {
224224
t.Fatalf("moveOrCopyFile: %v", err)
225225
}
226226

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ func (b *Builder) build(a *Action) (err error) {
432432
// Not covering this file.
433433
continue
434434
}
435-
if err := b.cover(a, coverFile, sourceFile, 0666, cover.Var); err != nil {
435+
if err := b.cover(a, coverFile, sourceFile, cover.Var); err != nil {
436436
return err
437437
}
438438
if i < len(gofiles) {
@@ -596,17 +596,17 @@ func (b *Builder) build(a *Action) (err error) {
596596
switch {
597597
case strings.HasSuffix(name, _goos_goarch):
598598
targ := file[:len(name)-len(_goos_goarch)] + "_GOOS_GOARCH." + ext
599-
if err := b.copyFile(a, objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
599+
if err := b.copyFile(objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
600600
return err
601601
}
602602
case strings.HasSuffix(name, _goarch):
603603
targ := file[:len(name)-len(_goarch)] + "_GOARCH." + ext
604-
if err := b.copyFile(a, objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
604+
if err := b.copyFile(objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
605605
return err
606606
}
607607
case strings.HasSuffix(name, _goos):
608608
targ := file[:len(name)-len(_goos)] + "_GOOS." + ext
609-
if err := b.copyFile(a, objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
609+
if err := b.copyFile(objdir+targ, filepath.Join(a.Package.Dir, file), 0666, true); err != nil {
610610
return err
611611
}
612612
}
@@ -954,7 +954,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
954954
}
955955
}
956956
var out []byte
957-
out, err = b.runOut(p.Dir, p.ImportPath, nil, b.PkgconfigCmd(), "--cflags", pcflags, "--", pkgs)
957+
out, err = b.runOut(p.Dir, nil, b.PkgconfigCmd(), "--cflags", pcflags, "--", pkgs)
958958
if err != nil {
959959
b.showOutput(nil, p.Dir, b.PkgconfigCmd()+" --cflags "+strings.Join(pcflags, " ")+strings.Join(pkgs, " "), string(out))
960960
b.Print(err.Error() + "\n")
@@ -966,7 +966,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
966966
return nil, nil, err
967967
}
968968
}
969-
out, err = b.runOut(p.Dir, p.ImportPath, nil, b.PkgconfigCmd(), "--libs", pcflags, "--", pkgs)
969+
out, err = b.runOut(p.Dir, nil, b.PkgconfigCmd(), "--libs", pcflags, "--", pkgs)
970970
if err != nil {
971971
b.showOutput(nil, p.Dir, b.PkgconfigCmd()+" --libs "+strings.Join(pcflags, " ")+strings.Join(pkgs, " "), string(out))
972972
b.Print(err.Error() + "\n")
@@ -1126,7 +1126,7 @@ func BuildInstallFunc(b *Builder, a *Action) (err error) {
11261126

11271127
defer b.cleanup(a1)
11281128

1129-
return b.moveOrCopyFile(a, a.Target, a1.built, perm, false)
1129+
return b.moveOrCopyFile(a.Target, a1.built, perm, false)
11301130
}
11311131

11321132
// cleanup removes a's object dir to keep the amount of
@@ -1143,7 +1143,7 @@ func (b *Builder) cleanup(a *Action) {
11431143
}
11441144

11451145
// moveOrCopyFile is like 'mv src dst' or 'cp src dst'.
1146-
func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, force bool) error {
1146+
func (b *Builder) moveOrCopyFile(dst, src string, perm os.FileMode, force bool) error {
11471147
if cfg.BuildN {
11481148
b.Showcmd("", "mv %s %s", src, dst)
11491149
return nil
@@ -1154,23 +1154,23 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
11541154

11551155
// If the source is in the build cache, we need to copy it.
11561156
if strings.HasPrefix(src, cache.DefaultDir()) {
1157-
return b.copyFile(a, dst, src, perm, force)
1157+
return b.copyFile(dst, src, perm, force)
11581158
}
11591159

11601160
// On Windows, always copy the file, so that we respect the NTFS
11611161
// permissions of the parent folder. https://golang.org/issue/22343.
11621162
// What matters here is not cfg.Goos (the system we are building
11631163
// for) but runtime.GOOS (the system we are building on).
11641164
if runtime.GOOS == "windows" {
1165-
return b.copyFile(a, dst, src, perm, force)
1165+
return b.copyFile(dst, src, perm, force)
11661166
}
11671167

11681168
// If the destination directory has the group sticky bit set,
11691169
// we have to copy the file to retain the correct permissions.
11701170
// https://golang.org/issue/18878
11711171
if fi, err := os.Stat(filepath.Dir(dst)); err == nil {
11721172
if fi.IsDir() && (fi.Mode()&os.ModeSetgid) != 0 {
1173-
return b.copyFile(a, dst, src, perm, force)
1173+
return b.copyFile(dst, src, perm, force)
11741174
}
11751175
}
11761176

@@ -1200,11 +1200,11 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
12001200
}
12011201
}
12021202

1203-
return b.copyFile(a, dst, src, perm, force)
1203+
return b.copyFile(dst, src, perm, force)
12041204
}
12051205

12061206
// copyFile is like 'cp src dst'.
1207-
func (b *Builder) copyFile(a *Action, dst, src string, perm os.FileMode, force bool) error {
1207+
func (b *Builder) copyFile(dst, src string, perm os.FileMode, force bool) error {
12081208
if cfg.BuildN || cfg.BuildX {
12091209
b.Showcmd("", "cp %s %s", src, dst)
12101210
if cfg.BuildN {
@@ -1295,12 +1295,12 @@ func (b *Builder) installHeader(a *Action) error {
12951295
}
12961296
}
12971297

1298-
return b.moveOrCopyFile(a, a.Target, src, 0666, true)
1298+
return b.moveOrCopyFile(a.Target, src, 0666, true)
12991299
}
13001300

13011301
// cover runs, in effect,
13021302
// go tool cover -mode=b.coverMode -var="varName" -o dst.go src.go
1303-
func (b *Builder) cover(a *Action, dst, src string, perm os.FileMode, varName string) error {
1303+
func (b *Builder) cover(a *Action, dst, src string, varName string) error {
13041304
return b.run(a, a.Objdir, "cover "+a.Package.ImportPath, nil,
13051305
cfg.BuildToolexec,
13061306
base.Tool("cover"),
@@ -1447,7 +1447,7 @@ var cgoTypeSigRe = regexp.MustCompile(`\b_C2?(type|func|var|macro)_\B`)
14471447
// If the command fails, run prints information about the failure
14481448
// and returns a non-nil error.
14491449
func (b *Builder) run(a *Action, dir string, desc string, env []string, cmdargs ...interface{}) error {
1450-
out, err := b.runOut(dir, desc, env, cmdargs...)
1450+
out, err := b.runOut(dir, env, cmdargs...)
14511451
if len(out) > 0 {
14521452
if desc == "" {
14531453
desc = b.fmtcmd(dir, "%s", strings.Join(str.StringList(cmdargs...), " "))
@@ -1479,7 +1479,7 @@ func (b *Builder) processOutput(out []byte) string {
14791479

14801480
// runOut runs the command given by cmdline in the directory dir.
14811481
// It returns the command output and any errors that occurred.
1482-
func (b *Builder) runOut(dir string, desc string, env []string, cmdargs ...interface{}) ([]byte, error) {
1482+
func (b *Builder) runOut(dir string, env []string, cmdargs ...interface{}) ([]byte, error) {
14831483
cmdline := str.StringList(cmdargs...)
14841484

14851485
for _, arg := range cmdline {
@@ -1691,7 +1691,7 @@ func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []s
16911691
if !filepath.IsAbs(outfile) {
16921692
outfile = filepath.Join(p.Dir, outfile)
16931693
}
1694-
output, err := b.runOut(filepath.Dir(file), desc, nil, compiler, flags, "-o", outfile, "-c", filepath.Base(file))
1694+
output, err := b.runOut(filepath.Dir(file), nil, compiler, flags, "-o", outfile, "-c", filepath.Base(file))
16951695
if len(output) > 0 {
16961696
// On FreeBSD 11, when we pass -g to clang 3.8 it
16971697
// invokes its internal assembler with -dwarf-version=2.
@@ -2215,7 +2215,7 @@ var (
22152215
)
22162216

22172217
func (b *Builder) swigDoVersionCheck() error {
2218-
out, err := b.runOut("", "", nil, "swig", "-version")
2218+
out, err := b.runOut("", nil, "swig", "-version")
22192219
if err != nil {
22202220
return err
22212221
}
@@ -2370,7 +2370,7 @@ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFL
23702370
args = append(args, "-c++")
23712371
}
23722372

2373-
out, err := b.runOut(p.Dir, p.ImportPath, nil, "swig", args, file)
2373+
out, err := b.runOut(p.Dir, nil, "swig", args, file)
23742374
if err != nil {
23752375
if len(out) > 0 {
23762376
if bytes.Contains(out, []byte("-intgosize")) || bytes.Contains(out, []byte("-cgo")) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, a
128128
args = append(args, mkAbs(p.Dir, f))
129129
}
130130

131-
output, err = b.runOut(p.Dir, p.ImportPath, nil, args...)
131+
output, err = b.runOut(p.Dir, nil, args...)
132132
return ofile, output, err
133133
}
134134

@@ -289,14 +289,14 @@ func (gcToolchain) pack(b *Builder, a *Action, afile string, ofiles []string) er
289289
if cfg.BuildN {
290290
return nil
291291
}
292-
if err := packInternal(b, absAfile, absOfiles); err != nil {
292+
if err := packInternal(absAfile, absOfiles); err != nil {
293293
b.showOutput(a, p.Dir, p.ImportPath, err.Error()+"\n")
294294
return errPrintedOutput
295295
}
296296
return nil
297297
}
298298

299-
func packInternal(b *Builder, afile string, ofiles []string) error {
299+
func packInternal(afile string, ofiles []string) error {
300300
dst, err := os.OpenFile(afile, os.O_WRONLY|os.O_APPEND, 0)
301301
if err != nil {
302302
return err

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (tools gccgoToolchain) gc(b *Builder, a *Action, archive string, importcfg
8585
args = append(args, mkAbs(p.Dir, f))
8686
}
8787

88-
output, err = b.runOut(p.Dir, p.ImportPath, nil, args)
88+
output, err = b.runOut(p.Dir, nil, args)
8989
return ofile, output, err
9090
}
9191

@@ -232,7 +232,7 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
232232
readAndRemoveCgoFlags := func(archive string) (string, error) {
233233
newID++
234234
newArchive := root.Objdir + fmt.Sprintf("_pkg%d_.a", newID)
235-
if err := b.copyFile(root, newArchive, archive, 0666, false); err != nil {
235+
if err := b.copyFile(newArchive, archive, 0666, false); err != nil {
236236
return "", err
237237
}
238238
if cfg.BuildN || cfg.BuildX {

0 commit comments

Comments
 (0)