Skip to content

Commit e17d129

Browse files
committed
there is a function for this
1 parent 31875e4 commit e17d129

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

cmd/local-artifact-mirror/pull.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"slices"
1011

1112
"github.com/sirupsen/logrus"
1213
"github.com/urfave/cli/v2"
@@ -140,7 +141,7 @@ var helmChartsCommand = &cli.Command{
140141
return fmt.Errorf("unable to read directory: %w", err)
141142
}
142143
for _, f := range files {
143-
if !contains(newFiles, f.Name()) {
144+
if !slices.Contains(newFiles, f.Name()) {
144145
fp := filepath.Join(dst, f.Name())
145146
logrus.Infof("removing %s", fp)
146147
if err := os.RemoveAll(fp); err != nil {
@@ -154,15 +155,6 @@ var helmChartsCommand = &cli.Command{
154155
},
155156
}
156157

157-
func contains(haystack []string, needle string) bool {
158-
for _, h := range haystack {
159-
if h == needle {
160-
return true
161-
}
162-
}
163-
return false
164-
}
165-
166158
// binariesCommands pulls the binary artifact from the registry running in the cluster and stores
167159
// it locally. This command is used during cluster upgrades when we want to fetch the most up to
168160
// date binaries. The binaries is stored in the /usr/local/bin directory and they overwrite the

0 commit comments

Comments
 (0)