Migrate location-related structs to the file package (#1751)

* migrate location structs to file package

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* replace source.Location refs with file package call

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* fix linting

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* remove hardlink test for file based catalogers

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* remove hardlink test for all-regular-files testing

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* migrate file resolver implementations to separate package

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* fix linting

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* [wip] migrate resolvers to internal

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

* migrate resolvers to syft/internal

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>

---------

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
Signed-off-by: <>
This commit is contained in:
Alex Goodman
2023-05-24 17:06:38 -04:00
committed by GitHub
parent 4bf17a94b9
commit 07e76907f6
313 changed files with 2316 additions and 2191 deletions
+6 -6
View File
@@ -7,8 +7,8 @@ import (
"github.com/anchore/syft/internal"
"github.com/anchore/syft/internal/log"
"github.com/anchore/syft/syft/artifact"
"github.com/anchore/syft/syft/file"
"github.com/anchore/syft/syft/license"
"github.com/anchore/syft/syft/source"
)
var _ sort.Interface = (*Licenses)(nil)
@@ -27,7 +27,7 @@ type License struct {
SPDXExpression string `json:"spdxExpression"`
Type license.Type `json:"type"`
URLs internal.StringSet `hash:"ignore"`
Locations source.LocationSet `hash:"ignore"`
Locations file.LocationSet `hash:"ignore"`
}
type Licenses []License
@@ -70,7 +70,7 @@ func NewLicense(value string) License {
SPDXExpression: spdxExpression,
Type: license.Declared,
URLs: internal.NewStringSet(),
Locations: source.NewLocationSet(),
Locations: file.NewLocationSet(),
}
}
@@ -85,7 +85,7 @@ func NewLicenseFromType(value string, t license.Type) License {
SPDXExpression: spdxExpression,
Type: t,
URLs: internal.NewStringSet(),
Locations: source.NewLocationSet(),
Locations: file.NewLocationSet(),
}
}
@@ -96,7 +96,7 @@ func NewLicensesFromValues(values ...string) (licenses []License) {
return
}
func NewLicensesFromLocation(location source.Location, values ...string) (licenses []License) {
func NewLicensesFromLocation(location file.Location, values ...string) (licenses []License) {
for _, v := range values {
if v == "" {
continue
@@ -106,7 +106,7 @@ func NewLicensesFromLocation(location source.Location, values ...string) (licens
return
}
func NewLicenseFromLocations(value string, locations ...source.Location) License {
func NewLicenseFromLocations(value string, locations ...file.Location) License {
l := NewLicense(value)
for _, loc := range locations {
l.Locations.Add(loc)