@@ -212,11 +212,10 @@ func doBuild(args []string) {
212
212
tmpDir := generateSourceFiles (& conf , "build" )
213
213
tmpFile := filepath .Join (tmpDir , "godebug.-i.a.out" )
214
214
215
- // Run 'go build -i' once without changing the GOPATH.
216
- // This will recompile and install any out-of-date packages.
217
- // When we modify the GOPATH in the next invocation of the go tool, it will
218
- // not check if any of the uninstrumented dependencies are out-of-date.
219
- shellGo ("" , []string {"build" , "-o" , tmpFile , "-tags" , * tags , "-i" }, goArgs )
215
+ if doGopathWorkaround {
216
+ // Rebuild stale packages, since this version of Go will not do so by default.
217
+ shellGo ("" , []string {"build" , "-o" , tmpFile , "-tags" , * tags , "-i" }, goArgs )
218
+ }
220
219
221
220
if isPkg {
222
221
goArgs = mapPkgsToTmpDir (goArgs )
@@ -248,12 +247,11 @@ func doRun(args []string) {
248
247
249
248
tmpDir := generateSourceFiles (& conf , "run" )
250
249
251
- // Run 'go build -i' once without changing the GOPATH.
252
- // This will recompile and install any out-of-date packages.
253
- // When we modify the GOPATH in the next invocation of the go tool, it will
254
- // not check if any of the uninstrumented dependencies are out-of-date.
255
- shellGo ("" , []string {"build" , "-o" , os .DevNull , "-tags" , * tags , "-i" },
256
- gofiles )
250
+ if doGopathWorkaround {
251
+ // Rebuild stale packages, since this version of Go will not do so by default.
252
+ shellGo ("" , []string {"build" , "-o" , os .DevNull , "-tags" , * tags , "-i" },
253
+ gofiles )
254
+ }
257
255
258
256
// Run 'go build', then run the binary.
259
257
// We do this rather than invoking 'go run' directly so we can implement
0 commit comments