Skip to content

Commit

Permalink
refactor: use log.FilePath()
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jul 2, 2024
1 parent 21ec7cd commit cf30a86
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/fanal/analyzer/sbom/sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (a sbomAnalyzer) Analyze(ctx context.Context, input analyzer.AnalysisInput)
return nil, xerrors.Errorf("failed to detect SBOM format: %w", err)
}

ctx = log.WithContextAttrs(ctx, log.String("file", input.FilePath))
ctx = log.WithContextAttrs(ctx, log.FilePath(input.FilePath))
bom, err := sbom.Decode(ctx, input.Content, format)
if err != nil {
return nil, xerrors.Errorf("SBOM decode error: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/artifact/sbom/sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (a Artifact) Inspect(ctx context.Context) (artifact.Reference, error) {
}
log.Info("Detected SBOM format", log.String("format", string(format)))

ctx = log.WithContextAttrs(ctx, log.String("file", a.filePath))
ctx = log.WithContextAttrs(ctx, log.FilePath(a.filePath))
bom, err := sbom.Decode(ctx, f, format)
if err != nil {
return artifact.Reference{}, xerrors.Errorf("SBOM decode error: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/handler/unpackaged/unpackaged.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (h unpackagedHook) Handle(ctx context.Context, res *analyzer.AnalysisResult
}

// Parse the fetched SBOM
ctx = log.WithContextAttrs(ctx, log.String("file", filePath))
ctx = log.WithContextAttrs(ctx, log.FilePath(filePath))
bom, err := sbom.Decode(ctx, bytes.NewReader(raw), format)
if err != nil {
return err
Expand Down

0 comments on commit cf30a86

Please sign in to comment.