This repository was archived by the owner on Aug 14, 2020. It is now read-only.
File tree 1 file changed +14
-9
lines changed 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,11 @@ func main() {
68
68
flag .StringVar (& goPathOpt , "go-path" , "" , "Custom GOPATH (default: a temporary directory)" )
69
69
flag .Parse ()
70
70
if os .Getenv ("GOPATH" ) != "" {
71
- warn ("GOPATH envvar is ignored, use --go-path=\" $GOPATH\" option instead" )
71
+ warn ("GOPATH env var is ignored, use --go-path=\" $GOPATH\" option instead" )
72
72
}
73
- if os .Getenv ("GOROOT" ) != "" {
74
- warn ("GOROOT envvar is ignored, use --go-binary=\" $GOROOT/bin/go\" option instead" )
73
+ goRoot := os .Getenv ("GOROOT" )
74
+ if goRoot != "" {
75
+ warn ("Overriding GOROOT env var to %s" , goRoot )
75
76
}
76
77
if os .Getenv ("GOACI_DEBUG" ) != "" {
77
78
Debug = true
@@ -131,13 +132,17 @@ func main() {
131
132
die ("error opening output file: %v" , err )
132
133
}
133
134
135
+ env := []string {
136
+ "GOPATH=" + goPathOpt ,
137
+ "GOBIN=" + gobin ,
138
+ "CGO_ENABLED=0" ,
139
+ "PATH=" + os .Getenv ("PATH" ),
140
+ }
141
+ if goRoot != "" {
142
+ env = append (env , "GOROOT=" + goRoot )
143
+ }
134
144
cmd := exec.Cmd {
135
- Env : []string {
136
- "GOPATH=" + goPathOpt ,
137
- "GOBIN=" + gobin ,
138
- "CGO_ENABLED=0" ,
139
- "PATH=" + os .Getenv ("PATH" ),
140
- },
145
+ Env : env ,
141
146
Path : goBinaryOpt ,
142
147
Args : args ,
143
148
Stderr : os .Stderr ,
You can’t perform that action at this time.
0 commit comments