diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 7a2e626..83964e6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -15,6 +15,6 @@ jobs: - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: - version: v1.63.4 + version: v2.0.2 diff --git a/.golangci.yml b/.golangci.yml index 60cef14..1727503 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,50 @@ -run: - timeout: 5m - -issues: - exclude-files: - - '(.+)_test\.go' - +version: "2" linters: - disable-all: false - presets: - - bugs - - unused - # - style - fast: false + enable: + - asasalint + - asciicheck + - bidichk + - bodyclose + - contextcheck + - durationcheck + - errchkjson + - errorlint + - exhaustive + - gocheckcompilerdirectives + - gochecksumtype + - gosec + - gosmopolitan + - loggercheck + - makezero + - musttag + - nilerr + - nilnesserr + - noctx + - protogetter + - reassign + - recvcheck + - rowserrcheck + - spancheck + - sqlclosecheck + - testifylint + - unparam + - zerologlint + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - (.+)_test\.go + - third_party$ + - builtin$ + - examples$ +formatters: + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/cmd/cloudfront.go b/cmd/cloudfront.go index 2602e9e..58dffe5 100644 --- a/cmd/cloudfront.go +++ b/cmd/cloudfront.go @@ -63,7 +63,7 @@ var cloudfrontCmd = &cobra.Command{ for _, distribution := range distributions { var val string - if *distribution.Distribution.DistributionConfig.Enabled == false { + if !*distribution.Distribution.DistributionConfig.Enabled { val = "disabled" rc = 2 totalCrit++ diff --git a/cmd/ec2_instances.go b/cmd/ec2_instances.go index 106b4bf..c805640 100644 --- a/cmd/ec2_instances.go +++ b/cmd/ec2_instances.go @@ -50,7 +50,7 @@ var ec2InstancesCmd = &cobra.Command{ summary += fmt.Sprintf(" %d %s ", count, state) ctr += count if ctr != len(instances.Instances) { - summary += fmt.Sprintf("-") + summary += "-" } } diff --git a/cmd/s3_buckets.go b/cmd/s3_buckets.go index 71db6a0..fb6054b 100644 --- a/cmd/s3_buckets.go +++ b/cmd/s3_buckets.go @@ -78,7 +78,7 @@ var s3BucketCmd = &cobra.Command{ } if len(buckets.Buckets) == 0 { - check.ExitError(fmt.Errorf("No buckets available")) + check.ExitError(fmt.Errorf("no buckets available")) } critical, err := internal.ParseThreshold(CriticalBucketSize) @@ -124,7 +124,7 @@ var s3BucketCmd = &cobra.Command{ output += objectsOutput.GetBucketOutput(bucketSize, rc) - if len(buckets.Buckets) > 1 && !(len(buckets.Buckets) == idx+1) { + if len(buckets.Buckets) > 1 && (len(buckets.Buckets) != idx+1) { output += "\n" } diff --git a/cmd/s3_objects.go b/cmd/s3_objects.go index 1693074..11bef49 100644 --- a/cmd/s3_objects.go +++ b/cmd/s3_objects.go @@ -89,7 +89,7 @@ var s3ObjectCmd = &cobra.Command{ } if len(buckets.Buckets) == 0 { - check.ExitError(fmt.Errorf("No buckets available")) + check.ExitError(fmt.Errorf("no buckets available")) } critical, err := internal.ParseThreshold(CriticalObjectSize) diff --git a/cmd/status.go b/cmd/status.go index 6b5d845..06fdd74 100644 --- a/cmd/status.go +++ b/cmd/status.go @@ -96,7 +96,7 @@ var statusCmd = &cobra.Command{ c := &http.Client{} if Region == "" && !contains(cliStatusConfig.Service, globalServices) { - check.ExitError(fmt.Errorf("Region required for regional services")) + check.ExitError(fmt.Errorf("region required for regional services")) } // Using + concatenation since the JoinPath will add / inbetween @@ -115,7 +115,7 @@ var statusCmd = &cobra.Command{ } if resp.StatusCode != http.StatusOK { - check.ExitError(fmt.Errorf("Could not get %s - Error: %d", feedUrl, resp.StatusCode)) + check.ExitError(fmt.Errorf("could not get %s - Error: %d", feedUrl, resp.StatusCode)) } defer resp.Body.Close() diff --git a/internal/s3/client.go b/internal/s3/client.go index 6f32119..392d848 100644 --- a/internal/s3/client.go +++ b/internal/s3/client.go @@ -8,7 +8,7 @@ import ( "github.com/aws/aws-sdk-go/service/s3" ) -var ErrBucketNotFound = errors.New("No such Bucket") +var ErrBucketNotFound = errors.New("no such Bucket") type S3Client struct { S3Client *s3.S3