diff --git a/.binny.yaml b/.binny.yaml index 9ab5d687..b3654ec0 100644 --- a/.binny.yaml +++ b/.binny.yaml @@ -26,7 +26,7 @@ tools: # used for linting - name: golangci-lint version: - want: v1.60.3 + want: v1.61.0 method: github-release with: repo: golangci/golangci-lint @@ -58,7 +58,7 @@ tools: # used to release all artifacts - name: goreleaser version: - want: v2.2.0 + want: v2.3.0 method: github-release with: repo: goreleaser/goreleaser @@ -90,7 +90,7 @@ tools: # used for running all local and CI tasks - name: task version: - want: v3.38.0 + want: v3.39.0 method: github-release with: repo: go-task/task @@ -98,7 +98,7 @@ tools: # used for triggering a release - name: gh version: - want: v2.55.0 + want: v2.56.0 method: github-release with: repo: cli/cli diff --git a/.golangci.yaml b/.golangci.yaml index 184f0f8e..7188b9b1 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -15,7 +15,7 @@ linters: - dogsled - dupl - errcheck - - exportloopref + - copyloopvar - funlen - gocognit - goconst diff --git a/cmd/grype/cli/ui/handle_update_vulnerability_database.go b/cmd/grype/cli/ui/handle_update_vulnerability_database.go index 51c9a078..6547b97b 100644 --- a/cmd/grype/cli/ui/handle_update_vulnerability_database.go +++ b/cmd/grype/cli/ui/handle_update_vulnerability_database.go @@ -27,7 +27,10 @@ func (s dbDownloadProgressStager) Stage() string { return "validating" } // show intermediate progress of the download - return fmt.Sprintf("%s / %s", humanize.Bytes(uint64(s.prog.Current())), humanize.Bytes(uint64(s.prog.Size()))) + return fmt.Sprintf("%s / %s", + humanize.Bytes(safeConvertInt64ToUint64(s.prog.Current())), + humanize.Bytes(safeConvertInt64ToUint64(s.prog.Size())), + ) } return stage } @@ -51,3 +54,10 @@ func (m *Handler) handleUpdateVulnerabilityDatabase(e partybus.Event) ([]tea.Mod return []tea.Model{tsk}, nil } + +func safeConvertInt64ToUint64(i int64) uint64 { + if i < 0 { + return 0 + } + return uint64(i) +}