mirror of
https://github.com/lxc/incus.git
synced 2026-02-05 09:46:19 +01:00
shared/subprocess: Simplify code by using modern constructs
Using more modern features of Go, such as: - conditional assignment -> built-in min or max in go1.21, - sort.Slice -> slices.Sort in go1.21, - loop assign map -> maps.Copy in go1.21, - []byte(fmt.Sprintf...) -> fmt.Appendf(nil,...) in go1.19, - strings.HasPrefix / strings.TrimPrefix -> strings.CutPrefix in go1.20 Signed-off-by: JUN JIE NAN <nanjunjie@gmail.com>
This commit is contained in:
committed by
Stéphane Graber
parent
8df4b1d9d6
commit
23bfc8a010
@@ -149,7 +149,7 @@ func TryRunCommandAttemptsDuration(attempts int, delay time.Duration, name strin
|
||||
var err error
|
||||
var output string
|
||||
|
||||
for i := 0; i < attempts; i++ {
|
||||
for range attempts {
|
||||
output, err = RunCommand(name, arg...)
|
||||
if err == nil {
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user