@@ -132,8 +132,10 @@ func (u *upstream) get(gopath, repo, rev string) error {
132
132
u .rr = rr
133
133
dir := filepath .Join (gopath , "src" , rr .Root )
134
134
if rev != "" {
135
+ // Run "git clone {repo} {dir}" and "git checkout {tag}"
135
136
return rr .VCS .CreateAtRev (dir , rr .Repo , rev )
136
137
}
138
+ // Run "git clone {repo} {dir}" (or the equivalent command for hg, svn, bzr)
137
139
return rr .VCS .Create (dir , rr .Repo )
138
140
}
139
141
@@ -216,25 +218,23 @@ func (u *upstream) tar(gopath, repo string) error {
216
218
// package type).
217
219
func (u * upstream ) findMains (gopath , repo string ) error {
218
220
cmd := exec .Command ("go" , "list" , "-e" , "-f" , "{{.ImportPath}} {{.Name}}" , repo + "/..." )
221
+ cmd .Dir = filepath .Join (gopath , "src" , repo )
222
+ cmd .Env = passthroughEnv ()
219
223
cmd .Stderr = os .Stderr
220
- cmd .Env = append ([]string {
221
- "GO111MODULE=off" ,
222
- "GOPATH=" + gopath ,
223
- }, passthroughEnv ()... )
224
-
224
+ log .Println ("findMains: Running" , cmd , "in" , cmd .Dir )
225
225
out , err := cmd .Output ()
226
226
if err != nil {
227
227
log .Println ("WARNING: In findMains:" , fmt .Errorf ("%q: %w" , cmd .Args , err ))
228
+ // See https://bugs.debian.org/992610
228
229
log .Printf ("Retrying without appending \" /...\" to repo" )
229
230
cmd = exec .Command ("go" , "list" , "-e" , "-f" , "{{.ImportPath}} {{.Name}}" , repo )
231
+ cmd .Dir = filepath .Join (gopath , "src" , repo )
232
+ cmd .Env = passthroughEnv ()
230
233
cmd .Stderr = os .Stderr
231
- cmd .Env = append ([]string {
232
- "GO111MODULE=off" ,
233
- "GOPATH=" + gopath ,
234
- }, passthroughEnv ()... )
234
+ log .Println ("findMains: Running" , cmd , "in" , cmd .Dir )
235
235
out , err = cmd .Output ()
236
236
if err != nil {
237
- return fmt .Errorf ("%q: %w" , cmd .Args , err )
237
+ log . Println ( "WARNING: In findMains:" , fmt .Errorf ("%q: %w" , cmd .Args , err ) )
238
238
}
239
239
}
240
240
for _ , line := range strings .Split (strings .TrimSpace (string (out )), "\n " ) {
@@ -257,25 +257,22 @@ func (u *upstream) findDependencies(gopath, repo string) error {
257
257
log .Printf ("Determining dependencies\n " )
258
258
259
259
cmd := exec .Command ("go" , "list" , "-e" , "-f" , "{{join .Imports \" \\ n\" }}\n {{join .TestImports \" \\ n\" }}\n {{join .XTestImports \" \\ n\" }}" , repo + "/..." )
260
+ cmd .Dir = filepath .Join (gopath , "src" , repo )
261
+ cmd .Env = passthroughEnv ()
260
262
cmd .Stderr = os .Stderr
261
- cmd .Env = append ([]string {
262
- "GO111MODULE=off" ,
263
- "GOPATH=" + gopath ,
264
- }, passthroughEnv ()... )
265
263
266
264
out , err := cmd .Output ()
267
265
if err != nil {
268
266
log .Println ("WARNING: In findDependencies:" , fmt .Errorf ("%q: %w" , cmd .Args , err ))
267
+ // See https://bugs.debian.org/992610
269
268
log .Printf ("Retrying without appending \" /...\" to repo" )
270
269
cmd = exec .Command ("go" , "list" , "-e" , "-f" , "{{join .Imports \" \\ n\" }}\n {{join .TestImports \" \\ n\" }}\n {{join .XTestImports \" \\ n\" }}" , repo )
270
+ cmd .Dir = filepath .Join (gopath , "src" , repo )
271
+ cmd .Env = passthroughEnv ()
271
272
cmd .Stderr = os .Stderr
272
- cmd .Env = append ([]string {
273
- "GO111MODULE=off" ,
274
- "GOPATH=" + gopath ,
275
- }, passthroughEnv ()... )
276
273
out , err = cmd .Output ()
277
274
if err != nil {
278
- return fmt .Errorf ("%q: %w" , cmd .Args , err )
275
+ log . Println ( "WARNING: In findDependencies:" , fmt .Errorf ("%q: %w" , cmd .Args , err ) )
279
276
}
280
277
}
281
278
@@ -301,12 +298,8 @@ func (u *upstream) findDependencies(gopath, repo string) error {
301
298
302
299
// Remove all packages which are in the standard lib.
303
300
cmd = exec .Command ("go" , "list" , "std" )
304
- cmd .Dir = filepath .Join (gopath , "src" , repo )
305
301
cmd .Stderr = os .Stderr
306
- cmd .Env = append ([]string {
307
- // Not affected by GO111MODULE
308
- "GOPATH=" + gopath ,
309
- }, passthroughEnv ()... )
302
+ cmd .Env = passthroughEnv ()
310
303
311
304
out , err = cmd .Output ()
312
305
if err != nil {
0 commit comments