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 {
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

View File

@ -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 {

View File

@ -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