lint: fix

Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
Christopher Phillips 2026-06-05 04:27:52 -04:00
parent 0dc4abc0e1
commit 4e79519d33
No known key found for this signature in database
3 changed files with 9 additions and 12 deletions

View File

@ -60,7 +60,8 @@ func TestOCIModelResolver_FilesByMediaType(t *testing.T) {
for _, test := range tests { for _, test := range tests {
t.Run(test.name, func(t *testing.T) { 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...) locations, err := resolver.FilesByMediaType(test.patterns...)
require.NoError(t, err) require.NoError(t, err)
@ -81,7 +82,8 @@ func TestOCIModelResolver_FileContentsByLocation(t *testing.T) {
digest: {TempPath: tempFile, MediaType: ggufLayerMediaType}, digest: {TempPath: tempFile, MediaType: ggufLayerMediaType},
} }
resolver := NewContainerImageModel(tempDir, layerFiles, "") ref := ""
resolver := NewContainerImageModel(tempDir, layerFiles, ref)
tests := []struct { tests := []struct {
name string name string

View File

@ -12,8 +12,8 @@ import (
"github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/pkg"
) )
// resolveSafeTensorsDirIdentity handles the directory-scan case: look for a // resolveSafeTensorsDirIdentity handles the directory-scan case for safe tensors
// config.json beside the model files (walking up parent directories to the // 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 // scanned source root if no sibling exists) and a sibling README.md. It returns
// the group's name candidates, resolved licenses, and supporting evidence. // the group's name candidates, resolved licenses, and supporting evidence.
func resolveSafeTensorsDirIdentity(ctx context.Context, resolver file.Resolver, dir string, md *pkg.SafeTensorsModelInfo) safeTensorsIdentity { func resolveSafeTensorsDirIdentity(ctx context.Context, resolver file.Resolver, dir string, md *pkg.SafeTensorsModelInfo) safeTensorsIdentity {

View File

@ -16,10 +16,7 @@ import (
"github.com/anchore/syft/syft/pkg/cataloger/internal/licenses" "github.com/anchore/syft/syft/pkg/cataloger/internal/licenses"
) )
// resolveSafeTensorsOCIIdentity handles the OCI-artifact case: the model's // resolveSafeTensorsOCIIdentity handles the OCI-artifact case
// 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.
func resolveSafeTensorsOCIIdentity(ctx context.Context, resolver file.Resolver, md *pkg.SafeTensorsModelInfo) safeTensorsIdentity { func resolveSafeTensorsOCIIdentity(ctx context.Context, resolver file.Resolver, md *pkg.SafeTensorsModelInfo) safeTensorsIdentity {
ociResolver, ok := resolver.(file.OCIMediaTypeResolver) ociResolver, ok := resolver.(file.OCIMediaTypeResolver)
if !ok { 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 // License precedence: a dedicated vnd.docker.ai.license layer is a
// producer-curated signal and outranks the free-text license field in a model // outranks the free-text license field in a model card's README frontmatter.
// card's README frontmatter.
licLocs, err := ociResolver.FilesByMediaType(dockerAILicenseMediaType) licLocs, err := ociResolver.FilesByMediaType(dockerAILicenseMediaType)
if err != nil { if err != nil {
log.Debugf("failed to list docker AI license layers: %v", err) 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 return nil, nil
} }
// identifyLicenseLayers turns Docker AI license-layer locations into // identifyLicenseLayers turns Docker AI license-layer locations into pkg.License values.
// pkg.License values.
func identifyLicenseLayers(ctx context.Context, resolver file.Resolver, locs []file.Location) []pkg.License { func identifyLicenseLayers(ctx context.Context, resolver file.Resolver, locs []file.Location) []pkg.License {
var out []pkg.License var out []pkg.License
var scanFallback []file.Location var scanFallback []file.Location