From 60dce6531e429cbe180b46e6eae54ea1245aece4 Mon Sep 17 00:00:00 2001 From: Guillaume Noale Date: Tue, 10 Jun 2025 17:34:32 +0200 Subject: [PATCH] chore(lint): pin golang-ci lint version * do not check ireturn anonymous --- .github/workflows/golangci-lint.yml | 2 +- .golangci.yml | 3 +++ internal/datasource/search.go | 2 +- internal/transport/retry.go | 2 +- internal/transport/retry_aws.go | 6 +++--- internal/types/map.go | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 25df19cac1..1b18f41605 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -16,5 +16,5 @@ jobs: uses: golangci/golangci-lint-action@v8.0.0 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: latest + version: v2.1.6 args: --timeout 5m diff --git a/.golangci.yml b/.golangci.yml index 276fbdba65..3f43ca0128 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -118,6 +118,9 @@ linters: rules: - name: exported disabled: true + ireturn: + reject: + - anon exclusions: rules: diff --git a/internal/datasource/search.go b/internal/datasource/search.go index ec71b44169..452039e90d 100644 --- a/internal/datasource/search.go +++ b/internal/datasource/search.go @@ -9,7 +9,7 @@ import ( // FindExact finds the first element in 'slice' matching the condition defined by 'finder'. // It returns the first matching element and an error if either no match is found or multiple matches are found. -func FindExact[T any](slice []T, finder func(T) bool, searchName string) (T, error) { //nolint +func FindExact[T any](slice []T, finder func(T) bool, searchName string) (T, error) { var found T var foundFlag bool diff --git a/internal/transport/retry.go b/internal/transport/retry.go index 45e5176068..05826ca58e 100644 --- a/internal/transport/retry.go +++ b/internal/transport/retry.go @@ -111,7 +111,7 @@ func (c *RetryableTransport) RoundTrip(r *http.Request) (*http.Response, error) return c.Do(req) } -func RetryOnTransientStateError[T any, U any](action func() (T, error), waiter func() (U, error)) (T, error) { //nolint +func RetryOnTransientStateError[T any, U any](action func() (T, error), waiter func() (U, error)) (T, error) { t, err := action() var transientStateError *scw.TransientStateError diff --git a/internal/transport/retry_aws.go b/internal/transport/retry_aws.go index 0afa9f1c74..2228063d6c 100644 --- a/internal/transport/retry_aws.go +++ b/internal/transport/retry_aws.go @@ -9,14 +9,14 @@ import ( ) // RetryWhenAWSErrCodeEquals retries a function when it returns a specific AWS error -func RetryWhenAWSErrCodeEquals[T any](ctx context.Context, codes []string, config *RetryWhenConfig[T]) (T, error) { //nolint: ireturn +func RetryWhenAWSErrCodeEquals[T any](ctx context.Context, codes []string, config *RetryWhenConfig[T]) (T, error) { return retryWhen(ctx, config, func(err error) bool { return tfawserr.ErrCodeEquals(err, codes...) }) } // RetryWhenAWSErrCodeNotEquals retries a function until it returns a specific AWS error -func RetryWhenAWSErrCodeNotEquals[T any](ctx context.Context, codes []string, config *RetryWhenConfig[T]) (T, error) { //nolint: ireturn +func RetryWhenAWSErrCodeNotEquals[T any](ctx context.Context, codes []string, config *RetryWhenConfig[T]) (T, error) { return retryWhen(ctx, config, func(err error) bool { if err == nil { return true @@ -28,7 +28,7 @@ func RetryWhenAWSErrCodeNotEquals[T any](ctx context.Context, codes []string, co // retryWhen executes the function passed in the configuration object until the timeout is reached or the context is cancelled. // It will retry if the shouldRetry function returns true. It will stop if the shouldRetry function returns false. -func retryWhen[T any](ctx context.Context, config *RetryWhenConfig[T], shouldRetry func(error) bool) (T, error) { //nolint: ireturn +func retryWhen[T any](ctx context.Context, config *RetryWhenConfig[T], shouldRetry func(error) bool) (T, error) { retryInterval := config.Interval if DefaultWaitRetryInterval != nil { retryInterval = *DefaultWaitRetryInterval diff --git a/internal/types/map.go b/internal/types/map.go index 9dcbe8b6f9..d301252423 100644 --- a/internal/types/map.go +++ b/internal/types/map.go @@ -72,7 +72,7 @@ func ExpandMapStringString(data any) map[string]string { // GetMapValue returns the value for a key from a map. // returns zero value if key does not exist in map. -func GetMapValue[T any]( //nolint:ireturn +func GetMapValue[T any]( m map[string]any, key string, ) T {