@@ -7,6 +7,7 @@ package main
7
7
import (
8
8
"bufio"
9
9
"bytes"
10
+ "cmd/go/internal/str"
10
11
"container/heap"
11
12
"debug/elf"
12
13
"errors"
@@ -2091,7 +2092,7 @@ func (b *builder) run(dir string, desc string, env []string, cmdargs ...interfac
2091
2092
out , err := b .runOut (dir , desc , env , cmdargs ... )
2092
2093
if len (out ) > 0 {
2093
2094
if desc == "" {
2094
- desc = b .fmtcmd (dir , "%s" , strings .Join (stringList (cmdargs ... ), " " ))
2095
+ desc = b .fmtcmd (dir , "%s" , strings .Join (str . StringList (cmdargs ... ), " " ))
2095
2096
}
2096
2097
b .showOutput (dir , desc , b .processOutput (out ))
2097
2098
if err != nil {
@@ -2121,7 +2122,7 @@ func (b *builder) processOutput(out []byte) string {
2121
2122
// runOut runs the command given by cmdline in the directory dir.
2122
2123
// It returns the command output and any errors that occurred.
2123
2124
func (b * builder ) runOut (dir string , desc string , env []string , cmdargs ... interface {}) ([]byte , error ) {
2124
- cmdline := stringList (cmdargs ... )
2125
+ cmdline := str . StringList (cmdargs ... )
2125
2126
if buildN || buildX {
2126
2127
var envcmdline string
2127
2128
for i := range env {
@@ -2450,7 +2451,7 @@ func toolVerify(b *builder, p *Package, newTool string, ofile string, args []int
2450
2451
return err
2451
2452
}
2452
2453
if ! bytes .Equal (data1 , data2 ) {
2453
- return fmt .Errorf ("%s and %s produced different output files:\n %s\n %s" , filepath .Base (args [1 ].(string )), newTool , strings .Join (stringList (args ... ), " " ), strings .Join (stringList (newArgs ... ), " " ))
2454
+ return fmt .Errorf ("%s and %s produced different output files:\n %s\n %s" , filepath .Base (args [1 ].(string )), newTool , strings .Join (str . StringList (args ... ), " " ), strings .Join (str . StringList (newArgs ... ), " " ))
2454
2455
}
2455
2456
os .Remove (ofile + ".new" )
2456
2457
return nil
@@ -2477,7 +2478,7 @@ func (gcToolchain) pack(b *builder, p *Package, objDir, afile string, ofiles []s
2477
2478
}
2478
2479
2479
2480
if buildN || buildX {
2480
- cmdline := stringList ("pack" , "r" , absAfile , absOfiles )
2481
+ cmdline := str . StringList ("pack" , "r" , absAfile , absOfiles )
2481
2482
b .showcmd (p .Dir , "%s # internal" , joinUnambiguously (cmdline ))
2482
2483
}
2483
2484
if buildN {
@@ -2692,7 +2693,7 @@ func (tools gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmh
2692
2693
if p .localPrefix != "" {
2693
2694
gcargs = append (gcargs , "-fgo-relative-import-path=" + p .localPrefix )
2694
2695
}
2695
- args := stringList (tools .compiler (), importArgs , "-c" , gcargs , "-o" , ofile , buildGccgoflags )
2696
+ args := str . StringList (tools .compiler (), importArgs , "-c" , gcargs , "-o" , ofile , buildGccgoflags )
2696
2697
for _ , f := range gofiles {
2697
2698
args = append (args , mkAbs (p .Dir , f ))
2698
2699
}
@@ -2913,7 +2914,7 @@ func (tools gccgoToolchain) link(b *builder, root *action, out string, allaction
2913
2914
ldflags = append (ldflags , root .p .CgoLDFLAGS ... )
2914
2915
}
2915
2916
2916
- ldflags = stringList ("-Wl,-(" , ldflags , "-Wl,-)" )
2917
+ ldflags = str . StringList ("-Wl,-(" , ldflags , "-Wl,-)" )
2917
2918
2918
2919
for _ , shlib := range shlibs {
2919
2920
ldflags = append (
@@ -3244,11 +3245,11 @@ func envList(key, def string) []string {
3244
3245
func (b * builder ) cflags (p * Package ) (cppflags , cflags , cxxflags , fflags , ldflags []string ) {
3245
3246
defaults := "-g -O2"
3246
3247
3247
- cppflags = stringList (envList ("CGO_CPPFLAGS" , "" ), p .CgoCPPFLAGS )
3248
- cflags = stringList (envList ("CGO_CFLAGS" , defaults ), p .CgoCFLAGS )
3249
- cxxflags = stringList (envList ("CGO_CXXFLAGS" , defaults ), p .CgoCXXFLAGS )
3250
- fflags = stringList (envList ("CGO_FFLAGS" , defaults ), p .CgoFFLAGS )
3251
- ldflags = stringList (envList ("CGO_LDFLAGS" , defaults ), p .CgoLDFLAGS )
3248
+ cppflags = str . StringList (envList ("CGO_CPPFLAGS" , "" ), p .CgoCPPFLAGS )
3249
+ cflags = str . StringList (envList ("CGO_CFLAGS" , defaults ), p .CgoCFLAGS )
3250
+ cxxflags = str . StringList (envList ("CGO_CXXFLAGS" , defaults ), p .CgoCXXFLAGS )
3251
+ fflags = str . StringList (envList ("CGO_FFLAGS" , defaults ), p .CgoFFLAGS )
3252
+ ldflags = str . StringList (envList ("CGO_LDFLAGS" , defaults ), p .CgoLDFLAGS )
3252
3253
return
3253
3254
}
3254
3255
@@ -3354,7 +3355,7 @@ func (b *builder) cgo(a *action, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofil
3354
3355
outGo = append (outGo , gofiles ... )
3355
3356
3356
3357
// gcc
3357
- cflags := stringList (cgoCPPFLAGS , cgoCFLAGS )
3358
+ cflags := str . StringList (cgoCPPFLAGS , cgoCFLAGS )
3358
3359
for _ , cfile := range cfiles {
3359
3360
ofile := obj + cfile [:len (cfile )- 1 ] + "o"
3360
3361
if err := b .gcc (p , ofile , cflags , obj + cfile ); err != nil {
@@ -3372,7 +3373,7 @@ func (b *builder) cgo(a *action, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofil
3372
3373
outObj = append (outObj , ofile )
3373
3374
}
3374
3375
3375
- cxxflags := stringList (cgoCPPFLAGS , cgoCXXFLAGS )
3376
+ cxxflags := str . StringList (cgoCPPFLAGS , cgoCXXFLAGS )
3376
3377
for _ , file := range gxxfiles {
3377
3378
// Append .o to the file, just in case the pkg has file.c and file.cpp
3378
3379
ofile := obj + cgoRe .ReplaceAllString (filepath .Base (file ), "_" ) + ".o"
@@ -3391,7 +3392,7 @@ func (b *builder) cgo(a *action, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofil
3391
3392
outObj = append (outObj , ofile )
3392
3393
}
3393
3394
3394
- fflags := stringList (cgoCPPFLAGS , cgoFFLAGS )
3395
+ fflags := str . StringList (cgoCPPFLAGS , cgoFFLAGS )
3395
3396
for _ , file := range ffiles {
3396
3397
// Append .o to the file, just in case the pkg has file.c and file.f
3397
3398
ofile := obj + cgoRe .ReplaceAllString (filepath .Base (file ), "_" ) + ".o"
@@ -3440,7 +3441,7 @@ func (b *builder) dynimport(p *Package, obj, importGo, cgoExe string, cflags, cg
3440
3441
return err
3441
3442
}
3442
3443
3443
- linkobj := stringList (ofile , outObj , p .SysoFiles )
3444
+ linkobj := str . StringList (ofile , outObj , p .SysoFiles )
3444
3445
dynobj := obj + "_cgo_.o"
3445
3446
3446
3447
// we need to use -pie for Linux/ARM to get accurate imported sym
@@ -3672,9 +3673,9 @@ func (b *builder) swigOne(p *Package, file, obj string, pcCFLAGS []string, cxx b
3672
3673
cgoCPPFLAGS , cgoCFLAGS , cgoCXXFLAGS , _ , _ := b .cflags (p )
3673
3674
var cflags []string
3674
3675
if cxx {
3675
- cflags = stringList (cgoCPPFLAGS , pcCFLAGS , cgoCXXFLAGS )
3676
+ cflags = str . StringList (cgoCPPFLAGS , pcCFLAGS , cgoCXXFLAGS )
3676
3677
} else {
3677
- cflags = stringList (cgoCPPFLAGS , pcCFLAGS , cgoCFLAGS )
3678
+ cflags = str . StringList (cgoCPPFLAGS , pcCFLAGS , cgoCFLAGS )
3678
3679
}
3679
3680
3680
3681
n := 5 // length of ".swig"
0 commit comments