Skip to content

Commit

Permalink
refactor: use log for logging error on exit
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <[email protected]>
  • Loading branch information
nikpivkin committed Dec 27, 2024
1 parent db8e61c commit e3a827b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions cmd/trivy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"context"
"errors"
"fmt"
"os"

"golang.org/x/xerrors"
Expand All @@ -25,8 +24,7 @@ func main() {

var userErr *types.UserError
if errors.As(err, &userErr) {
fmt.Println("Error: " + userErr.Error())
os.Exit(1)
log.Fatal("Error", log.Err(userErr))
}

log.Fatal("Fatal error", log.Err(err))
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/artifact/image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewArtifact(img types.Image, c cache.ArtifactCache, opt artifact.Option) (a

cacheDir, err := os.MkdirTemp("", "layers")
if err != nil {
return nil, xerrors.Errorf("failed to create a temp dir: %w", err)
return nil, xerrors.Errorf("failed to create a cache layers temp dir: %w", err)
}

return Artifact{
Expand Down

0 comments on commit e3a827b

Please sign in to comment.