diff --git a/.golangci.yml b/.golangci.yml index 8fece25..a6fbfc4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,22 +1,48 @@ -linters-settings: - misspell: - locale: US +version: "2" -issues: - exclude-rules: - - path: _test\.go - linters: - - containedctx - - dupl - - err113 - - text: Function `exitHealthchecksio` should pass the context parameter - linters: - - contextcheck - - source: "See https://" - linters: - - lll +formatters: + enable: + - gci + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ linters: + settings: + misspell: + locale: US + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - containedctx + - dupl + - err113 + path: _test\.go + - linters: + - contextcheck + text: Function `exitHealthchecksio` should pass the context parameter + - linters: + - lll + source: See https:// + - linters: + - revive + text: "var-naming: avoid meaningless package names" + path: internal\/provider\/utils\/ + paths: + - third_party$ + - builtin$ + - examples$ enable: # - cyclop - asasalint @@ -39,7 +65,6 @@ linters: - exhaustive - fatcontext - forcetypeassert - - gci - gocheckcompilerdirectives - gochecknoglobals - gochecknoinits @@ -49,9 +74,7 @@ linters: - gocritic - gocyclo - godot - - gofumpt - goheader - - goimports - gomoddirectives - goprintffuncname - gosec @@ -88,7 +111,6 @@ linters: - sloglint - sqlclosecheck - tagalign - - tenv - thelper - tparallel - unconvert diff --git a/Dockerfile b/Dockerfile index 8a4a93e..647254b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG BUILDPLATFORM=linux/amd64 ARG ALPINE_VERSION=3.22 ARG GO_VERSION=1.25 ARG XCPUTRANSLATE_VERSION=v0.9.0 -ARG GOLANGCI_LINT_VERSION=v1.61.0 +ARG GOLANGCI_LINT_VERSION=v2.4.0 ARG MOCKGEN_VERSION=v1.6.0 FROM --platform=${BUILDPLATFORM} ghcr.io/qdm12/xcputranslate:${XCPUTRANSLATE_VERSION} AS xcputranslate diff --git a/pkg/ipextract/ipextract_test.go b/pkg/ipextract/ipextract_test.go index df932c7..3ad73ea 100644 --- a/pkg/ipextract/ipextract_test.go +++ b/pkg/ipextract/ipextract_test.go @@ -121,7 +121,7 @@ func Benchmark_IPv6(b *testing.B) { " fac00" b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { _ = IPv6(text) } } diff --git a/pkg/publicip/http/providers.go b/pkg/publicip/http/providers.go index 8be499a..7332e4e 100644 --- a/pkg/publicip/http/providers.go +++ b/pkg/publicip/http/providers.go @@ -160,6 +160,6 @@ func (provider Provider) SupportsVersion(version ipversion.IPVersion) bool { // It is the responsibility of the caller to make sure it is a valid URL // and that it supports the desired IP version(s) as no further check is // done on it. -func CustomProvider(httpsURL *url.URL) Provider { //nolint:interfacer +func CustomProvider(httpsURL *url.URL) Provider { return Provider("url:" + httpsURL.String()) }