From 1a744928d2750a5b364a8269862afeee49ba2add Mon Sep 17 00:00:00 2001 From: vladopajic Date: Tue, 23 Jul 2024 13:11:49 +0200 Subject: [PATCH] lint bump to v1.59.1 (#96) --- .github/workflows/lint.yml | 2 +- .golangci.yml | 6 +++--- Makefile | 2 +- main.go | 2 +- pkg/testcoverage/badge/generate.go | 2 +- pkg/testcoverage/badge_test.go | 2 +- pkg/testcoverage/badgestorer/file.go | 2 +- pkg/testcoverage/check_test.go | 2 +- pkg/testcoverage/coverage/types.go | 2 +- pkg/testcoverage/report.go | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c9667cd..0c12580 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,6 +14,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.56.2 + version: v1.59.1 - name: go mod tidy check uses: katexochen/go-tidy-check@v2 diff --git a/.golangci.yml b/.golangci.yml index 986cd07..38bc21f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,6 +15,7 @@ linters: - dupl - durationcheck - dupword + - err113 - errcheck - errchkjson - errname @@ -33,12 +34,10 @@ linters: - gocritic - gocyclo - godox - - goerr113 - gofmt - gofumpt - goheader - goimports - - gomnd - gomoddirectives - gomodguard - goprintffuncname @@ -55,6 +54,7 @@ linters: - maintidx - mirror - misspell + - mnd - nakedret - nestif - nilerr @@ -180,4 +180,4 @@ issues: - text: "do not define dynamic errors" ## dynamic errors are okay is this is simple tool linters: - - goerr113 \ No newline at end of file + - err113 \ No newline at end of file diff --git a/Makefile b/Makefile index 92b2e14..bf0bd01 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GO ?= go GOBIN ?= $$($(GO) env GOPATH)/bin GOLANGCI_LINT ?= $(GOBIN)/golangci-lint -GOLANGCI_LINT_VERSION ?= v1.56.2 +GOLANGCI_LINT_VERSION ?= v1.59.1 # Code tidy .PHONY: tidy diff --git a/main.go b/main.go index 60ddcd1..62016c3 100644 --- a/main.go +++ b/main.go @@ -81,7 +81,7 @@ func (args) Version() string { return Name + " " + Version } -//nolint:cyclop,maintidx,gomnd // relax +//nolint:cyclop,maintidx,mnd // relax func (a *args) overrideConfig(cfg testcoverage.Config) (testcoverage.Config, error) { if !isCIDefaultString(a.Profile) { cfg.Profile = a.Profile diff --git a/pkg/testcoverage/badge/generate.go b/pkg/testcoverage/badge/generate.go index b7006b3..c1150ba 100644 --- a/pkg/testcoverage/badge/generate.go +++ b/pkg/testcoverage/badge/generate.go @@ -21,7 +21,7 @@ func Generate(coverage int) ([]byte, error) { } func Color(coverage int) string { - //nolint:gomnd // relax + //nolint:mnd // relax switch { case coverage >= 100: return "#44cc11" // strong green diff --git a/pkg/testcoverage/badge_test.go b/pkg/testcoverage/badge_test.go index a695b1e..230fc9e 100644 --- a/pkg/testcoverage/badge_test.go +++ b/pkg/testcoverage/badge_test.go @@ -30,7 +30,7 @@ func Test_GenerateAndSaveBadge_SaveToFile(t *testing.T) { const coverage = 100 - testFile := t.TempDir() + "/badge.svg" //nolint:goconst // relax + testFile := t.TempDir() + "/badge.svg" buf := &bytes.Buffer{} err := GenerateAndSaveBadge(buf, Config{ Badge: Badge{ diff --git a/pkg/testcoverage/badgestorer/file.go b/pkg/testcoverage/badgestorer/file.go index e043358..97b4b7c 100644 --- a/pkg/testcoverage/badgestorer/file.go +++ b/pkg/testcoverage/badgestorer/file.go @@ -10,7 +10,7 @@ func NewFile(filename string) Storer { return &fileStorer{filename: filename} } -//nolint:gosec,gomnd,wrapcheck // relax +//nolint:gosec,mnd,wrapcheck // relax func (s *fileStorer) Store(data []byte) (bool, error) { err := os.WriteFile(s.filename, data, 0o644) if err != nil { diff --git a/pkg/testcoverage/check_test.go b/pkg/testcoverage/check_test.go index 1e308f0..cb3422c 100644 --- a/pkg/testcoverage/check_test.go +++ b/pkg/testcoverage/check_test.go @@ -164,7 +164,7 @@ func TestCheckNoParallel(t *testing.T) { }) t.Run("ok pass; with github output file", func(t *testing.T) { - testFile := t.TempDir() + "/ga.output" //nolint: goconst // relax + testFile := t.TempDir() + "/ga.output" t.Setenv(GaOutputFileEnv, testFile) buf := &bytes.Buffer{} diff --git a/pkg/testcoverage/coverage/types.go b/pkg/testcoverage/coverage/types.go index 558cb2e..8d6f938 100644 --- a/pkg/testcoverage/coverage/types.go +++ b/pkg/testcoverage/coverage/types.go @@ -18,7 +18,7 @@ func (s Stats) CoveredPercentage() int { return CoveredPercentage(s.Total, s.Covered) } -//nolint:gomnd // relax +//nolint:mnd // relax func CoveredPercentage(total, covered int64) int { if total == 0 { return 0 diff --git a/pkg/testcoverage/report.go b/pkg/testcoverage/report.go index 3782198..3443cc2 100644 --- a/pkg/testcoverage/report.go +++ b/pkg/testcoverage/report.go @@ -17,7 +17,7 @@ func ReportForHuman(w io.Writer, result AnalyzeResult) { out := bufio.NewWriter(w) defer out.Flush() - tabber := tabwriter.NewWriter(out, 1, 8, 2, '\t', 0) //nolint:gomnd // relax + tabber := tabwriter.NewWriter(out, 1, 8, 2, '\t', 0) //nolint:mnd // relax defer tabber.Flush() statusStr := func(passing bool) string { @@ -124,7 +124,7 @@ func SetGithubActionOutput(result AnalyzeResult) error { } func openGitHubOutput(p string) (io.WriteCloser, error) { - //nolint:gomnd,wrapcheck // error is wrapped at level above + //nolint:mnd,wrapcheck // error is wrapped at level above return os.OpenFile(p, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644) }