Skip to content

Commit

Permalink
Replace slices.Contains usage with helper func
Browse files Browse the repository at this point in the history
The 8.12 branch is not yet on Go 1.21 so the slices package isn't available.
  • Loading branch information
andrewkroh committed Jan 24, 2024
1 parent bbc8563 commit 5bedd68
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dev-tools/packaging/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"os"
"path/filepath"
"regexp"
"slices"
"strings"
"testing"

Expand Down Expand Up @@ -694,7 +693,7 @@ func readDocker(dockerFile string) (*packageFile, *dockerInfo, error) {
if err != nil {
return nil, nil, err
}
case slices.Contains(manifest.Layers, header.Name):
case sliceContains(manifest.Layers, header.Name):
layer, err := readTarContents(header.Name, tarReader)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -828,3 +827,12 @@ func readDockerInfo(r io.Reader) (*dockerInfo, error) {

return &info, nil
}

func sliceContains(s []string, e string) bool {
for _, v := range s {
if e == v {
return true
}
}
return false
}

0 comments on commit 5bedd68

Please sign in to comment.