@@ -432,7 +432,7 @@ func (b *Builder) build(a *Action) (err error) {
432
432
// Not covering this file.
433
433
continue
434
434
}
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 {
436
436
return err
437
437
}
438
438
if i < len (gofiles ) {
@@ -596,17 +596,17 @@ func (b *Builder) build(a *Action) (err error) {
596
596
switch {
597
597
case strings .HasSuffix (name , _goos_goarch ):
598
598
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 {
600
600
return err
601
601
}
602
602
case strings .HasSuffix (name , _goarch ):
603
603
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 {
605
605
return err
606
606
}
607
607
case strings .HasSuffix (name , _goos ):
608
608
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 {
610
610
return err
611
611
}
612
612
}
@@ -954,7 +954,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
954
954
}
955
955
}
956
956
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 )
958
958
if err != nil {
959
959
b .showOutput (nil , p .Dir , b .PkgconfigCmd ()+ " --cflags " + strings .Join (pcflags , " " )+ strings .Join (pkgs , " " ), string (out ))
960
960
b .Print (err .Error () + "\n " )
@@ -966,7 +966,7 @@ func (b *Builder) getPkgConfigFlags(p *load.Package) (cflags, ldflags []string,
966
966
return nil , nil , err
967
967
}
968
968
}
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 )
970
970
if err != nil {
971
971
b .showOutput (nil , p .Dir , b .PkgconfigCmd ()+ " --libs " + strings .Join (pcflags , " " )+ strings .Join (pkgs , " " ), string (out ))
972
972
b .Print (err .Error () + "\n " )
@@ -1126,7 +1126,7 @@ func BuildInstallFunc(b *Builder, a *Action) (err error) {
1126
1126
1127
1127
defer b .cleanup (a1 )
1128
1128
1129
- return b .moveOrCopyFile (a , a .Target , a1 .built , perm , false )
1129
+ return b .moveOrCopyFile (a .Target , a1 .built , perm , false )
1130
1130
}
1131
1131
1132
1132
// cleanup removes a's object dir to keep the amount of
@@ -1143,7 +1143,7 @@ func (b *Builder) cleanup(a *Action) {
1143
1143
}
1144
1144
1145
1145
// 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 {
1147
1147
if cfg .BuildN {
1148
1148
b .Showcmd ("" , "mv %s %s" , src , dst )
1149
1149
return nil
@@ -1154,23 +1154,23 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
1154
1154
1155
1155
// If the source is in the build cache, we need to copy it.
1156
1156
if strings .HasPrefix (src , cache .DefaultDir ()) {
1157
- return b .copyFile (a , dst , src , perm , force )
1157
+ return b .copyFile (dst , src , perm , force )
1158
1158
}
1159
1159
1160
1160
// On Windows, always copy the file, so that we respect the NTFS
1161
1161
// permissions of the parent folder. https://golang.org/issue/22343.
1162
1162
// What matters here is not cfg.Goos (the system we are building
1163
1163
// for) but runtime.GOOS (the system we are building on).
1164
1164
if runtime .GOOS == "windows" {
1165
- return b .copyFile (a , dst , src , perm , force )
1165
+ return b .copyFile (dst , src , perm , force )
1166
1166
}
1167
1167
1168
1168
// If the destination directory has the group sticky bit set,
1169
1169
// we have to copy the file to retain the correct permissions.
1170
1170
// https://golang.org/issue/18878
1171
1171
if fi , err := os .Stat (filepath .Dir (dst )); err == nil {
1172
1172
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 )
1174
1174
}
1175
1175
}
1176
1176
@@ -1200,11 +1200,11 @@ func (b *Builder) moveOrCopyFile(a *Action, dst, src string, perm os.FileMode, f
1200
1200
}
1201
1201
}
1202
1202
1203
- return b .copyFile (a , dst , src , perm , force )
1203
+ return b .copyFile (dst , src , perm , force )
1204
1204
}
1205
1205
1206
1206
// 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 {
1208
1208
if cfg .BuildN || cfg .BuildX {
1209
1209
b .Showcmd ("" , "cp %s %s" , src , dst )
1210
1210
if cfg .BuildN {
@@ -1295,12 +1295,12 @@ func (b *Builder) installHeader(a *Action) error {
1295
1295
}
1296
1296
}
1297
1297
1298
- return b .moveOrCopyFile (a , a .Target , src , 0666 , true )
1298
+ return b .moveOrCopyFile (a .Target , src , 0666 , true )
1299
1299
}
1300
1300
1301
1301
// cover runs, in effect,
1302
1302
// 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 {
1304
1304
return b .run (a , a .Objdir , "cover " + a .Package .ImportPath , nil ,
1305
1305
cfg .BuildToolexec ,
1306
1306
base .Tool ("cover" ),
@@ -1447,7 +1447,7 @@ var cgoTypeSigRe = regexp.MustCompile(`\b_C2?(type|func|var|macro)_\B`)
1447
1447
// If the command fails, run prints information about the failure
1448
1448
// and returns a non-nil error.
1449
1449
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 ... )
1451
1451
if len (out ) > 0 {
1452
1452
if desc == "" {
1453
1453
desc = b .fmtcmd (dir , "%s" , strings .Join (str .StringList (cmdargs ... ), " " ))
@@ -1479,7 +1479,7 @@ func (b *Builder) processOutput(out []byte) string {
1479
1479
1480
1480
// runOut runs the command given by cmdline in the directory dir.
1481
1481
// 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 ) {
1483
1483
cmdline := str .StringList (cmdargs ... )
1484
1484
1485
1485
for _ , arg := range cmdline {
@@ -1691,7 +1691,7 @@ func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []s
1691
1691
if ! filepath .IsAbs (outfile ) {
1692
1692
outfile = filepath .Join (p .Dir , outfile )
1693
1693
}
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 ))
1695
1695
if len (output ) > 0 {
1696
1696
// On FreeBSD 11, when we pass -g to clang 3.8 it
1697
1697
// invokes its internal assembler with -dwarf-version=2.
@@ -2215,7 +2215,7 @@ var (
2215
2215
)
2216
2216
2217
2217
func (b * Builder ) swigDoVersionCheck () error {
2218
- out , err := b .runOut ("" , "" , nil , "swig" , "-version" )
2218
+ out , err := b .runOut ("" , nil , "swig" , "-version" )
2219
2219
if err != nil {
2220
2220
return err
2221
2221
}
@@ -2370,7 +2370,7 @@ func (b *Builder) swigOne(a *Action, p *load.Package, file, objdir string, pcCFL
2370
2370
args = append (args , "-c++" )
2371
2371
}
2372
2372
2373
- out , err := b .runOut (p .Dir , p . ImportPath , nil , "swig" , args , file )
2373
+ out , err := b .runOut (p .Dir , nil , "swig" , args , file )
2374
2374
if err != nil {
2375
2375
if len (out ) > 0 {
2376
2376
if bytes .Contains (out , []byte ("-intgosize" )) || bytes .Contains (out , []byte ("-cgo" )) {
0 commit comments