Skip to content

Commit d8500e6

Browse files
authored
Don't reuse exec.Cmd (#42)
1 parent 5b5d3fb commit d8500e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/builder/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ func GetModules(cfg Config) error {
124124
}
125125

126126
cfg.Logger.Info("Getting go modules")
127-
cmd := exec.Command(goBinary, "mod", "download")
128-
cmd.Dir = cfg.Distribution.OutputPath
129127

130128
// basic retry if error from go mod command (in case of transient network error). This could be improved
131129
// retry 3 times with 5 second spacing interval
132130
retries := 3
133131
failReason := "unknown"
134132
for i := 1; i <= retries; i++ {
133+
cmd := exec.Command(goBinary, "mod", "download")
134+
cmd.Dir = cfg.Distribution.OutputPath
135135
if out, err := cmd.CombinedOutput(); err != nil {
136136
failReason = fmt.Sprintf("%s. Output: %q", err, out)
137137
cfg.Logger.Info("Failed modules download", "retry", fmt.Sprintf("%d/%d", i, retries))

0 commit comments

Comments
 (0)