Skip to content

Commit

Permalink
Use slices.DeleteFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Apr 17, 2024
1 parent 37f618a commit bdf673f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"os/signal"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -329,18 +330,12 @@ func cleanup(ctx context.Context, client *http.Client, url, requestID string) er
}

func withoutEnv(env []string, prefixes ...string) []string {
result := make([]string, 0, len(env))
for _, v := range env {
ok := true
return slices.DeleteFunc(env, func(v string) bool {
for _, prefix := range prefixes {
if strings.HasPrefix(v, prefix) {
ok = false
break
return true
}
}
if ok {
result = append(result, v)
}
}
return result
return false
})
}

0 comments on commit bdf673f

Please sign in to comment.