Skip to content

Commit 537c77d

Browse files
committed
fix: remove custom type for codes
1 parent 2bafa82 commit 537c77d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/scanner/osv.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
)
1414

1515
type osvReferenceKind string
16-
type osvReturnCode int
1716

1817
const (
1918
OsvCommandName = "osv-scanner"
@@ -22,9 +21,9 @@ const (
2221
PackageKind osvReferenceKind = "PACKAGE"
2322
osvTimeout = 5 * time.Minute
2423
// https://google.github.io/osv-scanner/output/#return-codes
25-
osvReturnCodeSuccess osvReturnCode = 0
26-
osvReturnCodeVulnsFound osvReturnCode = 1
27-
osvReturnCodeNoPackages osvReturnCode = 128
24+
osvReturnCodeSuccess int = 0
25+
osvReturnCodeVulnsFound int = 1
26+
osvReturnCodeNoPackages int = 128
2827
)
2928

3029
type osvSource struct {
@@ -121,11 +120,11 @@ func (s *osvScanner) Scan(dir string) (*OsvReport, error) {
121120
)
122121

123122
//Handle exit codes according to https://google.github.io/osv-scanner/output/#return-codes
124-
if cmdOut.ExitCode == int(osvReturnCodeSuccess) && err == nil {
123+
if cmdOut.ExitCode == osvReturnCodeSuccess && err == nil {
125124
// Successful run of osv-scanner, no report because no vulnerabilities found
126125
log.Debug().Int("exitCode", cmdOut.ExitCode).Msg("osv-scanner did not find vulnerabilities")
127126
return nil, nil
128-
} else if cmdOut.ExitCode == int(osvReturnCodeNoPackages) {
127+
} else if cmdOut.ExitCode == osvReturnCodeNoPackages {
129128
log.Warn().Int("exitCode", cmdOut.ExitCode).Msg("osv-scanner did not find any packages to scan")
130129
return nil, nil
131130
} else if cmdOut.ExitCode > 1 || cmdOut.ExitCode == -1 {

0 commit comments

Comments
 (0)