Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrade golangci-lint #673

Merged
merged 6 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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