Skip to content

Commit

Permalink
Move to golangci 1.62.0
Browse files Browse the repository at this point in the history
Moving to the latest version errors out on inactivated linters (that were deprecated
earlier). This required commenting out these linters till we ensure we have enabled
the required replacements correctly.

The linters that are inacivated (and hence commented out) are:
deadcode, execinquery, golint, ifshort, maligned, scopelint, strutcheck, varcheck

gomnd is replaced by mnd

exportloopref is replaced by copyloopvar, but not enabled in this commit to address
linter issues in code.

Signed-off-by: Shyamsundar Ranganathan <[email protected]>
  • Loading branch information
ShyamsundarR committed Nov 26, 2024
1 parent a669424 commit b0d4702
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ramen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- name: GolangCI Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.55.2
version: v1.62.0
working-directory: ${{ matrix.directory }}

unit-test:
Expand Down
22 changes: 11 additions & 11 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ linters:
- asciicheck
- bidichk
- bodyclose
# - copyloopvar // Additional new replacement for go 1.22 (https://go.dev/blog/loopvar-preview) (deprecating exportloopref)
- cyclop
- deadcode
# - deadcode // Fully deprecated, remove this line once an alternative is enabled for the same
- decorder
# - depguard
- dogsled
Expand All @@ -113,9 +114,8 @@ linters:
- errcheck
- errchkjson
# - errorlint
- execinquery
# - execinquery // Fully deprecated, remove this line once an alternative is enabled for the same
- exhaustive
- exportloopref
- forbidigo
- funlen
- gocognit
Expand All @@ -124,24 +124,24 @@ linters:
- gocyclo
- gofmt
- gofumpt
- golint
- gomnd
# - golint // Fully deprecated, remove this line once an alternative is enabled for the same
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- grouper
- ifshort
# - ifshort // Fully deprecated, remove this line once an alternative is enabled for the same
- importas
- ineffassign
- interfacebloat
- lll
- logrlint
- loggercheck
- maintidx
- makezero
- maligned
# - maligned // Fully deprecated, remove this line once an alternative is enabled for the same
- misspell
- mnd
# - nakedret
- nestif
- nilerr
Expand All @@ -155,9 +155,9 @@ linters:
- reassign
- revive
- rowserrcheck
- scopelint
# - scopelint // Fully deprecated, remove this line once an alternative is enabled for the same
- sqlclosecheck
- structcheck
# - structcheck // Fully deprecated, remove this line once an alternative is enabled for the same
- stylecheck
- tenv
- testpackage
Expand All @@ -168,7 +168,7 @@ linters:
- unparam
- unused
- usestdlibvars
- varcheck
# - varcheck // Fully deprecated, remove this line once an alternative is enabled for the same
- wastedassign
- whitespace
- wsl
Expand Down
2 changes: 1 addition & 1 deletion hack/install-golangci-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
script_dir="$(cd "$(dirname "$0")" && pwd)"

source_url="https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh"
required_version="1.55.2"
required_version="1.62.0"
target_dir="${script_dir}/../testbin"
target_path="${target_dir}/golangci-lint"
tool="golangci-lint"
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/drclusterconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (r *DRClusterConfigReconciler) SetupWithManager(mgr ctrl.Manager) error {
rateLimiter := workqueue.NewTypedMaxOfRateLimiter(
workqueue.NewTypedItemExponentialFailureRateLimiter[reconcile.Request](1*time.Second, maxReconcileBackoff),
// defaults from client-go
//nolint: gomnd
//nolint: mnd
&workqueue.TypedBucketRateLimiter[reconcile.Request]{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
)

Expand Down
2 changes: 1 addition & 1 deletion internal/controller/util/drpolicy_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func DRPolicyS3Profiles(drpolicy *rmn.DRPolicy, drclusters []rmn.DRCluster) sets
return mustHaveS3Profiles
}

//nolint:gomnd
//nolint:mnd
func GetSecondsFromSchedulingInterval(drpolicy *rmn.DRPolicy) (float64, error) {
schedulingInterval := drpolicy.Spec.SchedulingInterval
if schedulingInterval == "" {
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/volumereplicationgroup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (r *VolumeReplicationGroupReconciler) SetupWithManager(
rateLimiter := workqueue.NewTypedMaxOfRateLimiter(
workqueue.NewTypedItemExponentialFailureRateLimiter[reconcile.Request](1*time.Second, 1*time.Minute),
// defaults from client-go
//nolint: gomnd
//nolint: mnd
&workqueue.TypedBucketRateLimiter[reconcile.Request]{Limiter: rate.NewLimiter(rate.Limit(10), 100)},
)
if r.RateLimiter != nil {
Expand Down

0 comments on commit b0d4702

Please sign in to comment.