Skip to content

Commit

Permalink
refactor: upgrade golangci-lint (#673)
Browse files Browse the repository at this point in the history
Note that the `SBOMReader` refactor wasn't required for this, but my IDE
flagged it so I just included it here 馃し
  • Loading branch information
G-Rath committed Nov 23, 2023
1 parent 54d61f3 commit 1bd6916
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ runs:
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.54.2
version: v1.55.2
# https://github.com/golangci/golangci-lint-action/issues/135
skip-pkg-cache: true
3 changes: 2 additions & 1 deletion cmd/osv-scanner/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -59,7 +60,7 @@ func dedent(t *testing.T, str string) string {
}
}

re := regexp.MustCompile(`\n[\t ]{` + fmt.Sprint(size) + `}`)
re := regexp.MustCompile(`\n[\t ]{` + strconv.Itoa(size) + `}`)
str = re.ReplaceAllString(str, "\n")
}

Expand Down
12 changes: 6 additions & 6 deletions internal/sbom/sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ type Identifier struct {
PURL string
}

// SBOMReader is an interface for all SBOM providers.
type SBOMReader interface {
// Reader is an interface for all SBOM providers.
type Reader interface {
Name() string
// Checks if the file path is a standard recognized file name
MatchesRecognizedFileNames(string) bool
GetPackages(io.ReadSeeker, func(Identifier) error) error
// MatchesRecognizedFileNames checks if the file path is a standard recognized file name
MatchesRecognizedFileNames(path string) bool
GetPackages(r io.ReadSeeker, callback func(Identifier) error) error
}

var (
Providers = []SBOMReader{
Providers = []Reader{
&SPDX{},
&CycloneDX{},
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/depsdev/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func MakeVersionRequests(queries []*depsdevpb.GetVersionRequest) ([][]models.Lic

return err
}
ls := make([]models.License, len(resp.Licenses))
for j, license := range resp.Licenses {
ls := make([]models.License, len(resp.GetLicenses()))
for j, license := range resp.GetLicenses() {
ls[j] = models.License(license)
}
if len(ls) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/lockfile/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type DepFile interface {
// current DepFile if the provided path is relative.
//
// If the path is an absolute path, then it is opened absolutely.
Open(string) (NestedDepFile, error)
Open(path string) (NestedDepFile, error)

Path() string
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_lints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -ex

go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2 run ./... --max-same-issues 0
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 run ./... --max-same-issues 0

0 comments on commit 1bd6916

Please sign in to comment.