mirror of
https://github.com/anchore/syft.git
synced 2026-07-05 02:28:25 +02:00
lint: fix
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
parent
0dc4abc0e1
commit
4e79519d33
@ -60,7 +60,8 @@ func TestOCIModelResolver_FilesByMediaType(t *testing.T) {
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
resolver := NewContainerImageModel(tempDir, test.layerFiles, "")
|
||||
ref := ""
|
||||
resolver := NewContainerImageModel(tempDir, test.layerFiles, ref)
|
||||
|
||||
locations, err := resolver.FilesByMediaType(test.patterns...)
|
||||
require.NoError(t, err)
|
||||
@ -81,7 +82,8 @@ func TestOCIModelResolver_FileContentsByLocation(t *testing.T) {
|
||||
digest: {TempPath: tempFile, MediaType: ggufLayerMediaType},
|
||||
}
|
||||
|
||||
resolver := NewContainerImageModel(tempDir, layerFiles, "")
|
||||
ref := ""
|
||||
resolver := NewContainerImageModel(tempDir, layerFiles, ref)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@ -12,8 +12,8 @@ import (
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
)
|
||||
|
||||
// resolveSafeTensorsDirIdentity handles the directory-scan case: look for a
|
||||
// config.json beside the model files (walking up parent directories to the
|
||||
// resolveSafeTensorsDirIdentity handles the directory-scan case for safe tensors
|
||||
// find config.json beside the model files (walking up parent directories to the
|
||||
// scanned source root if no sibling exists) and a sibling README.md. It returns
|
||||
// the group's name candidates, resolved licenses, and supporting evidence.
|
||||
func resolveSafeTensorsDirIdentity(ctx context.Context, resolver file.Resolver, dir string, md *pkg.SafeTensorsModelInfo) safeTensorsIdentity {
|
||||
|
||||
@ -16,10 +16,7 @@ import (
|
||||
"github.com/anchore/syft/syft/pkg/cataloger/internal/licenses"
|
||||
)
|
||||
|
||||
// resolveSafeTensorsOCIIdentity handles the OCI-artifact case: the model's
|
||||
// naming and license signals arrive as sibling layers (model.file companions
|
||||
// carrying config.json / README, and dedicated license layers). It returns the
|
||||
// group's name candidates, resolved licenses, and supporting evidence.
|
||||
// resolveSafeTensorsOCIIdentity handles the OCI-artifact case
|
||||
func resolveSafeTensorsOCIIdentity(ctx context.Context, resolver file.Resolver, md *pkg.SafeTensorsModelInfo) safeTensorsIdentity {
|
||||
ociResolver, ok := resolver.(file.OCIMediaTypeResolver)
|
||||
if !ok {
|
||||
@ -68,8 +65,7 @@ func resolveSafeTensorsOCIIdentity(ctx context.Context, resolver file.Resolver,
|
||||
}
|
||||
|
||||
// License precedence: a dedicated vnd.docker.ai.license layer is a
|
||||
// producer-curated signal and outranks the free-text license field in a model
|
||||
// card's README frontmatter.
|
||||
// outranks the free-text license field in a model card's README frontmatter.
|
||||
licLocs, err := ociResolver.FilesByMediaType(dockerAILicenseMediaType)
|
||||
if err != nil {
|
||||
log.Debugf("failed to list docker AI license layers: %v", err)
|
||||
@ -142,8 +138,7 @@ func classifyOCIModelFileLayer(resolver file.Resolver, loc file.Location) (*hfCo
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// identifyLicenseLayers turns Docker AI license-layer locations into
|
||||
// pkg.License values.
|
||||
// identifyLicenseLayers turns Docker AI license-layer locations into pkg.License values.
|
||||
func identifyLicenseLayers(ctx context.Context, resolver file.Resolver, locs []file.Location) []pkg.License {
|
||||
var out []pkg.License
|
||||
var scanFallback []file.Location
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user