Skip to content

Commit f76bbba

Browse files
refactor(workdir): remove unnecessary global NoConfirm mutation in removeMake (#2906)
refactor(workdir): remove unnecessary global NoConfirm mutation in removeMake removeMake always removes packages non-interactively, so it sets settings.NoConfirm = true, calls BuildPacmanCmd, then restores the original value. This pattern is thread-unsafe and redundant because BuildPacmanCmd already accepts a noConfirm bool parameter. Pass true directly to BuildPacmanCmd, eliminating the global mutation.
1 parent bc68b37 commit f76bbba

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

pkg/sync/workdir/clean.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ func removeMake(ctx context.Context, config *settings.Configuration,
2626
removeArguments.AddTarget(pkg)
2727
}
2828

29-
oldValue := settings.NoConfirm
30-
settings.NoConfirm = true
29+
// removeMake always runs non-interactively; pass noConfirm=true directly
30+
// rather than mutating the global settings.NoConfirm.
3131
err = cmdBuilder.Show(cmdBuilder.BuildPacmanCmd(ctx,
32-
removeArguments, config.Mode, settings.NoConfirm))
33-
settings.NoConfirm = oldValue
32+
removeArguments, config.Mode, true))
3433

3534
return err
3635
}

0 commit comments

Comments
 (0)