diff --git a/internal/archive/zip_file_manifest.go b/internal/archive/zip_file_manifest.go index e22d60b80..3bf534690 100644 --- a/internal/archive/zip_file_manifest.go +++ b/internal/archive/zip_file_manifest.go @@ -2,7 +2,6 @@ package archive import ( "fmt" - "github.com/anchore/syft/syft/file" "os" "sort" "strings" @@ -49,7 +48,7 @@ func (z ZipFileManifest) GlobMatch(patterns ...string) []string { // so that glob logic is consistent inside and outside of ZIP archives normalizedEntry := normalizeZipEntryName(entry) - if file.GlobMatch(pattern, normalizedEntry) { + if internal.FileNameGlobMatch(pattern, normalizedEntry) { uniqueMatches.Add(entry) } } diff --git a/syft/file/glob_match.go b/internal/filename_glob_match.go similarity index 80% rename from syft/file/glob_match.go rename to internal/filename_glob_match.go index 6befe32e4..308349e17 100644 --- a/syft/file/glob_match.go +++ b/internal/filename_glob_match.go @@ -1,8 +1,8 @@ -package file +package internal -// GlobMatch evaluates the given glob pattern against the given "name" string, indicating if there is a match or not. +// FileNameGlobMatch evaluates the given glob pattern against the given "name" string, indicating if there is a match or not. // Source: https://research.swtch.com/glob.go -func GlobMatch(pattern, name string) bool { +func FileNameGlobMatch(pattern, name string) bool { px := 0 nx := 0 nextPx := 0 diff --git a/syft/file/glob_match_test.go b/internal/filename_glob_match_test.go similarity index 90% rename from syft/file/glob_match_test.go rename to internal/filename_glob_match_test.go index aab2803dc..917b1bd5f 100644 --- a/syft/file/glob_match_test.go +++ b/internal/filename_glob_match_test.go @@ -1,4 +1,4 @@ -package file +package internal import ( "strings" @@ -32,7 +32,7 @@ func TestGlobMatch(t *testing.T) { } for _, test := range tests { - if GlobMatch(test.pattern, test.data) != test.ok { + if FileNameGlobMatch(test.pattern, test.data) != test.ok { t.Errorf("failed glob='%s' data='%s'", test.pattern, test.data) } } diff --git a/syft/pkg/cataloger/python/parse_wheel_egg_metadata.go b/syft/pkg/cataloger/python/parse_wheel_egg_metadata.go index b189e6cc3..0955d0172 100644 --- a/syft/pkg/cataloger/python/parse_wheel_egg_metadata.go +++ b/syft/pkg/cataloger/python/parse_wheel_egg_metadata.go @@ -3,7 +3,7 @@ package python import ( "bufio" "fmt" - "github.com/anchore/syft/syft/file" + "github.com/anchore/syft/internal" "io" "path/filepath" "strings" @@ -82,7 +82,7 @@ func parseWheelOrEggMetadata(path string, reader io.Reader) (pkg.PythonPackageMe // of egg metadata (as opposed to a directory that contains more metadata // files). func isEggRegularFile(path string) bool { - return file.GlobMatch(eggFileMetadataGlob, path) + return internal.FileNameGlobMatch(eggFileMetadataGlob, path) } // determineSitePackagesRootPath returns the path of the site packages root,