diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a3b265d..f435fe8 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -24,10 +24,10 @@ jobs: go-version: stable - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v6.5.0 + 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: v1.64.5 + version: v2.4.0 # Optional: working directory, useful for monorepos # working-directory: somedir diff --git a/.golangci.yml b/.golangci.yml index 9fe5bb1..745f906 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,68 +1,86 @@ -# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml +# See https://golangci-lint.run/docs/linters/configuration/ +version: "2" run: tests: true - -linters-settings: - errcheck: - check-type-assertions: true - check-blank: true - gocyclo: - min-complexity: 20 - dupl: - threshold: 100 - misspell: - locale: US - unparam: - check-exported: true - linters: - enable-all: true + default: all disable: - - err113 - - cyclop - - musttag - - intrange + - wsl_v5 + - noctx + - funcorder + - embeddedstructfieldcheck + - noinlineerr - copyloopvar - - lll - - gochecknoglobals - - wrapcheck - - paralleltest + - cyclop + - depguard + - dupword + - err113 + - errname + - exhaustruct - forbidigo - forcetypeassert - - varnamelen - - tagliatelle - - errname + - gochecknoglobals + - intrange - ireturn - - exhaustruct + - lll + - mnd + - musttag - nonamedreturns - - testableexamples - - dupword - - depguard + - paralleltest + - recvcheck - tagalign - - mnd + - tagliatelle + - testableexamples - testifylint - - recvcheck - -issues: - exclude-use-default: false - exclude-rules: - - linters: - - wsl - - wastedassign - - ineffassign - - mnd - - goconst - - noctx - - funlen - - dupl - - unused - - unparam - path: "_test.go" - - linters: - - errcheck # Error checking omitted for brevity. - - gosec - path: "example_" - - linters: - - revive - text: "unused-parameter: parameter" - + - varnamelen + - wrapcheck + settings: + dupl: + threshold: 100 + errcheck: + check-type-assertions: true + check-blank: true + gocyclo: + min-complexity: 20 + misspell: + locale: US + unparam: + check-exported: true + exclusions: + generated: lax + rules: + - linters: + - dupl + - funlen + - goconst + - ineffassign + - mnd + - noctx + - unparam + - unused + - wastedassign + - wsl + path: _test.go + - linters: + - errcheck + - gosec + path: example_ + - linters: + - revive + text: 'unused-parameter: parameter' + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gci + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 8b4c583..dbf621b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -#GOLANGCI_LINT_VERSION := "v1.64.5" # Optional configuration to pinpoint golangci-lint version. +#GOLANGCI_LINT_VERSION := "v2.4.0" # Optional configuration to pinpoint golangci-lint version. # The head of Makefile determines location of dev-go to include standard targets. GO ?= go diff --git a/go.mod b/go.mod index 3600cd5..ec176e2 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/Masterminds/squirrel v1.5.4 github.com/bool64/ctxd v1.2.1 - github.com/bool64/dev v0.2.40 + github.com/bool64/dev v0.2.41 github.com/jmoiron/sqlx v1.4.0 github.com/stretchr/testify v1.8.2 ) diff --git a/go.sum b/go.sum index a0f35da..622bdf0 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8 github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10= github.com/bool64/ctxd v1.2.1 h1:hARFteq0zdn4bwfmxLhak3fXFuvtJVKDH2X29VV/2ls= github.com/bool64/ctxd v1.2.1/go.mod h1:ZG6QkeGVLTiUl2mxPpyHmFhDzFZCyocr9hluBV3LYuc= -github.com/bool64/dev v0.2.40 h1:LUSD+Aq+WB3KwVntqXstevJ0wB12ig1bEgoG8ZafsZU= -github.com/bool64/dev v0.2.40/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg= +github.com/bool64/dev v0.2.41 h1:aic7tEGMkqyH7kckksR1ddagAZtlSIFHvYBOsqn01+U= +github.com/bool64/dev v0.2.41/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/misc/pg_create_table.go b/misc/pg_create_table.go index 52789b5..c1ab5a2 100644 --- a/misc/pg_create_table.go +++ b/misc/pg_create_table.go @@ -1,5 +1,5 @@ // Package misc contains miscellaneous helpers. -package misc +package misc //nolint:revive import ( "database/sql" diff --git a/storage_go1.18.go b/storage_go1.18.go index c092148..3595e96 100644 --- a/storage_go1.18.go +++ b/storage_go1.18.go @@ -68,7 +68,7 @@ func Table[V any](storage *Storage, tableName string) StorageOf[V] { } ar.Referencer = storage.MakeReferencer() - ar.Referencer.AddTableAlias(ar.R, tableName) + ar.AddTableAlias(ar.R, tableName) return ar }