From 8e5380c693343c691e3be7778f65ca0699c1ba90 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Tue, 12 Mar 2024 09:49:02 +0100 Subject: [PATCH] Update golangci-lint to v1.56.2 and fix lints Signed-off-by: Sascha Grunert --- .github/workflows/lint.yml | 2 +- .golangci.yml | 12 ++++++++---- cmd/krel/cmd/release_notes.go | 1 - cmd/krel/cmd/sign_images.go | 2 +- dependencies.yaml | 2 +- pkg/anago/release.go | 6 +++--- pkg/build/push.go | 2 +- pkg/notes/notes.go | 2 +- 8 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 78b774b1e80..6b782c62271 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,5 +23,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 with: - version: v1.55 + version: v1.56 args: --timeout=15m diff --git a/.golangci.yml b/.golangci.yml index 7da552fce4c..8821999eb0a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -61,7 +61,6 @@ linters: - nakedret - nolintlint - nosprintfhostport - - perfsprint - prealloc - predeclared - promlinter @@ -70,6 +69,7 @@ linters: - revive - rowserrcheck - sloglint + - spancheck - sqlclosecheck - staticcheck - stylecheck @@ -113,8 +113,9 @@ linters: # - noctx # - nonamedreturns # - paralleltest - # - testifylint + # - perfsprint # - tagliatelle + # - testifylint # - testpackage # - thelper # - tparallel @@ -123,6 +124,10 @@ linters: # - wrapcheck # - wsl linters-settings: + revive: + rules: + - name: unused-parameter + disabled: true gocyclo: min-complexity: 40 godox: @@ -144,6 +149,7 @@ linters-settings: - badLock - badRegexp - badSorting + - badSyncOnceFunc - boolExprSimplify - builtinShadow - builtinShadowDecl @@ -209,7 +215,6 @@ linters-settings: - sliceClear - sloppyLen - sloppyReassign - - sloppyTestFuncName - sloppyTypeAssert - sortSlice - sprintfQuotedString @@ -219,7 +224,6 @@ linters-settings: - stringsCompare - switchTrue - syncMapLoadAndDelete - - timeCmpSimplify - timeExprSimplify - todoCommentWithoutDetail - tooManyResultsChecker diff --git a/cmd/krel/cmd/release_notes.go b/cmd/krel/cmd/release_notes.go index 882f3b80e41..5bf505f3bf2 100644 --- a/cmd/krel/cmd/release_notes.go +++ b/cmd/krel/cmd/release_notes.go @@ -1401,7 +1401,6 @@ func editReleaseNote(pr int, workDir string, originalNote, modifiedNote *notes.R // Verify that the new yaml is valid and can be serialized back into a Map testMap := notes.ReleaseNotesMap{} err = yaml.Unmarshal(changes, &testMap) - if err != nil { logrus.Error("The YAML code has errors") return true, fmt.Errorf("while verifying if changes are a valid map: %w", err) diff --git a/cmd/krel/cmd/sign_images.go b/cmd/krel/cmd/sign_images.go index 73682777534..7edb5bb5d35 100644 --- a/cmd/krel/cmd/sign_images.go +++ b/cmd/krel/cmd/sign_images.go @@ -37,7 +37,7 @@ func init() { } // TODO: implement me :) -func runSignImages(signOpts *signOptions, args []string) error { //nolint:revive,unparam // keeping the parameters for reference +func runSignImages(signOpts *signOptions, args []string) error { //nolint:unparam // keeping the parameters for reference logrus.Info("Not implemented") return nil diff --git a/dependencies.yaml b/dependencies.yaml index 26bc1e7b6a5..36cb59ead3b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -386,7 +386,7 @@ dependencies: # golangci-lint-version - name: "golangci-lint" - version: v1.55 + version: v1.56 refPaths: - path: .github/workflows/lint.yml match: "version: v\\d+.\\d+?\\.?(\\d+)?" diff --git a/pkg/anago/release.go b/pkg/anago/release.go index 5b559a0dcf4..788336bf4ba 100644 --- a/pkg/anago/release.go +++ b/pkg/anago/release.go @@ -221,9 +221,9 @@ func (d *defaultReleaseImpl) ValidateImages( } func (d *defaultReleaseImpl) PublishVersion( - buildType, version, buildDir, bucket, gcsRoot string, //nolint: revive,gocritic - versionMarkers []string, //nolint: revive,gocritic - privateBucket, fast bool, //nolint: revive,gocritic + buildType, version, buildDir, bucket, gcsRoot string, //nolint: gocritic + versionMarkers []string, //nolint: gocritic + privateBucket, fast bool, //nolint: gocritic ) error { return release. NewPublisher(). diff --git a/pkg/build/push.go b/pkg/build/push.go index 56cbd5c9388..75b2e3d3dbf 100644 --- a/pkg/build/push.go +++ b/pkg/build/push.go @@ -459,7 +459,7 @@ func (bi *Instance) PushContainerImages() error { // TODO: Investigate if it's worthwhile to use any of the bi.objStore.Get*Path() // // functions here or create a new one to populate staging paths -func (bi *Instance) CopyStagedFromGCS(stagedBucket, buildVersion string) error { //nolint:revive // keeping the parameters for reference +func (bi *Instance) CopyStagedFromGCS(stagedBucket, buildVersion string) error { logrus.Info("Copy staged release artifacts from GCS") bi.objStore.SetOptions( diff --git a/pkg/notes/notes.go b/pkg/notes/notes.go index 8d97f92960c..f946a410fad 100644 --- a/pkg/notes/notes.go +++ b/pkg/notes/notes.go @@ -803,7 +803,7 @@ func (g *Gatherer) notesForCommit(commit *gogithub.RepositoryCommit) (*Result, e } // If we found a valid release note, return the PR, otherwise, take the next one - if len(s) > 0 { + if s != "" { res := &Result{commit: commit, pullRequest: pr} logrus.Infof("PR #%d seems to contain a release note", pr.GetNumber()) // Do not test further PRs for this commit as soon as one PR matched