diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aa161ea..7ff7637 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,7 +65,7 @@ jobs: go-version: "1.26.2" # update together with dev.dockerfile - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: - version: "v2.11.4" # update together with dev.dockerfile + version: "v2.12.1" # update together with dev.dockerfile lint-latest-deps: runs-on: ubuntu-latest @@ -77,7 +77,7 @@ jobs: - run: make apply-latest-deps - uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: - version: "v2.11.4" # update together with dev.dockerfile + version: "v2.12.1" # update together with dev.dockerfile check-tidy: name: go mod tidy diff --git a/.golangci.yml b/.golangci.yml index 457a99e..94eb8d6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -40,6 +40,7 @@ linters: - bidichk # checks for dangerous unicode character sequences - bodyclose # checks whether HTTP response body is closed successfully - canonicalheader # checks whether net/http.Header uses canonical header + - clickhouselint # detects common mistakes with the ClickHouse native Go driver API - copyloopvar # detects places where loop variables are copied (Go 1.22+) - cyclop # checks function and package cyclomatic complexity - depguard # checks if package imports are in a list of acceptable packages @@ -89,6 +90,7 @@ linters: - nolintlint # reports ill-formed or insufficient nolint directives - nonamedreturns # reports all named returns - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL + - paralleltest # detects missing usage of t.Parallel() method in your Go test - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative - predeclared # finds code that shadows one of Go's predeclared identifiers - promlinter # checks Prometheus metrics naming via promlint @@ -146,7 +148,6 @@ linters: #- maintidx # measures the maintainability index of each function #- misspell # [useless] finds commonly misspelled English words in comments #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity - #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test #- tagliatelle # checks the struct tags #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines @@ -395,21 +396,15 @@ linters: - github.com/jmoiron/sqlx sloglint: - # Enforce not using global loggers. - # Values: - # - "": disabled - # - "all": report all global loggers - # - "default": report only the default slog logger - # https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-global - # Default: "" + # Report the use of global loggers. + # https://github.com/go-simpler/sloglint#no-global-logger + # Values: "all", "default" + # Default: "" (disabled) no-global: all - # Enforce using methods that accept a context. - # Values: - # - "": disabled - # - "all": report all contextless calls - # - "scope": report only if a context exists in the scope of the outermost function - # https://github.com/go-simpler/sloglint?tab=readme-ov-file#context-only - # Default: "" + # Report the use of functions without a context.Context. + # https://github.com/go-simpler/sloglint#context-only + # Values: "all", "scope" + # Default: "" (disabled) context: scope staticcheck: diff --git a/dev.dockerfile b/dev.dockerfile index 0e3bf4b..f222433 100644 --- a/dev.dockerfile +++ b/dev.dockerfile @@ -2,7 +2,7 @@ FROM golang:1.26.2 AS go # update together with .github/workflows/ci.yml -FROM golangci/golangci-lint:v2.11.4 AS linter +FROM golangci/golangci-lint:v2.12.1 AS linter FROM go AS dev ENV INSIDE_DEV_CONTAINER=1 diff --git a/pkg/testpackage/testpackage_test.go b/pkg/testpackage/testpackage_test.go index f45a05b..3604b5c 100644 --- a/pkg/testpackage/testpackage_test.go +++ b/pkg/testpackage/testpackage_test.go @@ -10,6 +10,8 @@ import ( ) func TestAnalyzer_Good(t *testing.T) { + t.Parallel() + testdata, err := filepath.Abs("testdata/good") if err != nil { t.FailNow() @@ -19,6 +21,8 @@ func TestAnalyzer_Good(t *testing.T) { } func TestAnalyzer_Bad(t *testing.T) { + t.Parallel() + testdata, err := filepath.Abs("testdata/bad") if err != nil { t.FailNow() @@ -28,6 +32,8 @@ func TestAnalyzer_Bad(t *testing.T) { } func TestAnalyzer_Allowed(t *testing.T) { + t.Parallel() + analyzer := testpackage.NewAnalyzer() err := analyzer.Flags.Set(testpackage.AllowPackagesFlagName, "allowed") @@ -44,6 +50,8 @@ func TestAnalyzer_Allowed(t *testing.T) { } func TestAnalyzer_InvalidRegexp(t *testing.T) { + t.Parallel() + invalid := `\Ca` analyzer := testpackage.NewAnalyzer() err := analyzer.Flags.Set(testpackage.SkipRegexpFlagName, invalid)