diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 27e4c607..74a60ca7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -30,9 +30,9 @@ jobs: go-version: stable - name: Lint Go - uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2 + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: - version: v1.64.8 # renovate: datasource=github-tags depName=golangci/golangci-lint + version: v2.1.5 # renovate: datasource=github-tags depName=golangci/golangci-lint actionlint: name: Actionlint diff --git a/.golangci.yml b/.golangci.yml index d1325f56..a4427222 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,44 +1,6 @@ -linters-settings: - misspell: - locale: US - revive: - ignore-generated-header: true - rules: - - name: blank-imports - - name: constant-logical-expr - - name: context-as-argument - - name: context-keys-type - - name: defer - - name: dot-imports - - name: duplicated-imports - - name: empty-block - - name: error-naming - - name: error-return - - name: error-strings - - name: errorf - - name: exported - - name: import-shadowing - - name: increment-decrement - - name: indent-error-flow - - name: package-comments - - name: range - - name: range-val-address - - name: range-val-in-closure - - name: receiver-naming - - name: redefines-builtin-id - - name: string-of-int - - name: superfluous-else - - name: time-naming - - name: unchecked-type-assertion - - name: unexported-return - - name: unnecessary-stmt - - name: unreachable-code - - name: unused-parameter - - name: var-declaration - - name: var-naming - govet: - enable-all: true +version: "2" linters: + default: none enable: - asasalint - asciicheck @@ -58,11 +20,7 @@ linters: - gochecksumtype - gocritic - godot - - gofmt - - gofumpt - - goimports - gosec - - gosimple - gosmopolitan - govet - ineffassign @@ -83,13 +41,10 @@ linters: - reassign - revive - staticcheck - - stylecheck - tagalign - - tenv - testpackage - thelper - tparallel - - typecheck - unconvert - unparam - unused @@ -97,9 +52,67 @@ linters: - wastedassign - whitespace - wrapcheck - disable-all: true + settings: + govet: + enable-all: true + misspell: + locale: US + revive: + rules: + - name: blank-imports + - name: constant-logical-expr + - name: context-as-argument + - name: context-keys-type + - name: defer + - name: dot-imports + - name: duplicated-imports + - name: empty-block + - name: error-naming + - name: error-return + - name: error-strings + - name: errorf + - name: exported + - name: import-shadowing + - name: increment-decrement + - name: indent-error-flow + - name: package-comments + - name: range + - name: range-val-address + - name: range-val-in-closure + - name: receiver-naming + - name: redefines-builtin-id + - name: string-of-int + - name: superfluous-else + - name: time-naming + - name: unchecked-type-assertion + - name: unexported-return + - name: unnecessary-stmt + - name: unreachable-code + - name: unused-parameter + - name: var-declaration + - name: var-naming + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ issues: max-issues-per-linter: 0 max-same-issues: 0 -run: - timeout: 5m +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index de7808a1..7ca6ee08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - id: detect-private-key - repo: https://github.com/golangci/golangci-lint - rev: v1.64.8 + rev: v2.1.5 hooks: - id: golangci-lint-full diff --git a/Makefile b/Makefile index 45ffd11c..7fc4d820 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .DEFAULT_GOAL := build-goreleaser # renovate: datasource=github-tags depName=golangci/golangci-lint -GOLANGCI_LINT_VERSION = v1.64.8 +GOLANGCI_LINT_VERSION = v2.1.5 # renovate: datasource=docker depName=goreleaser/goreleaser GORELEASER_VERSION = v2.9.0 # renovate: datasource=go depName=google/go-licenses diff --git a/cmd/sync/aws.go b/cmd/sync/aws.go index b78f469d..bcd221c7 100644 --- a/cmd/sync/aws.go +++ b/cmd/sync/aws.go @@ -275,7 +275,7 @@ func validateAWSConfig(cfg *awsConfig) error { if ups.Port == 0 { return fmt.Errorf(upstreamPortErrorMsgFormat, ups.Name) } - if ups.Kind == "" || !(ups.Kind == "http" || ups.Kind == "stream") { + if ups.Kind == "" || (ups.Kind != "http" && ups.Kind != "stream") { return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name) } if ups.MaxConns < 0 { diff --git a/cmd/sync/azure.go b/cmd/sync/azure.go index bd8db687..9ecc8e35 100644 --- a/cmd/sync/azure.go +++ b/cmd/sync/azure.go @@ -203,7 +203,7 @@ func validateAzureConfig(cfg *azureConfig) error { if ups.Port == 0 { return fmt.Errorf(upstreamPortErrorMsgFormat, ups.Name) } - if ups.Kind == "" || !(ups.Kind == "http" || ups.Kind == "stream") { + if ups.Kind == "" || (ups.Kind != "http" && ups.Kind != "stream") { return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name) } if ups.MaxConns < 0 {