Skip to content

Commit

Permalink
Skip cleaning in earlier stages as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Aug 11, 2021
1 parent eafe033 commit 34cc74f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@ func (b Builder) newEnvironment(ctx context.Context) (*environment, error) {
if err != nil {
return nil, err
}
env := &environment{
k6Version: b.K6Version,
extensions: b.Extensions,
k6ModulePath: k6ModulePath,
tempFolder: tempFolder,
timeoutGoGet: b.TimeoutGet,
skipCleanup: b.SkipCleanup,
}
defer func() {
if err != nil {
err2 := os.RemoveAll(tempFolder)
err2 := env.Close()
if err2 != nil {
err = fmt.Errorf("%w; additionally, cleaning up folder: %v", err, err2)
}
Expand All @@ -84,15 +92,6 @@ func (b Builder) newEnvironment(ctx context.Context) (*environment, error) {
return nil, err
}

env := &environment{
k6Version: b.K6Version,
extensions: b.Extensions,
k6ModulePath: k6ModulePath,
tempFolder: tempFolder,
timeoutGoGet: b.TimeoutGet,
skipCleanup: b.SkipCleanup,
}

// initialize the go module
log.Println("[INFO] Initializing Go module")
cmd := env.newCommand("go", "mod", "init", "k6")
Expand Down

0 comments on commit 34cc74f

Please sign in to comment.