You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore(lint): configure goconst linter
Enable goconst linter with min-occurrences threshold of 3 and exclude
well-known protocol values that don't need constants:
- DNS record types (A, AAAA, CNAME, TXT, etc.)
- Boolean strings ("true", "false")
- Common null indicators ("none")
- Registry types (aws-sd, noop)
This catches genuinely problematic string repetitions while avoiding
over-engineering for standard protocol values.
Co-Authored-By: Claude <[email protected]>
* docs(lint): update golangci-lint documentation URLs
Update all linter documentation references from deprecated /usage/ paths
to current /docs/ paths. Fix errorlint anchor from #errcheck to #errorlint.
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
Copy file name to clipboardExpand all lines: .golangci.yml
+25-15Lines changed: 25 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,38 +1,39 @@
1
-
# https://golangci-lint.run/usage/configuration/
1
+
# https://golangci-lint.run/docs/configuration/
2
2
version: "2"
3
3
linters:
4
4
default: none
5
5
enable: # golangci-lint help linters
6
-
- copyloopvar # A linter detects places where loop variables are copied. https://golangci-lint.run/usage/linters/#copyloopvar
7
-
- dogsled # Checks assignments with too many blank identifiers. https://golangci-lint.run/usage/linters/#dogsled
8
-
- dupword # Duplicate word. https://golangci-lint.run/usage/linters/#dupword
6
+
- copyloopvar # A linter detects places where loop variables are copied. https://golangci-lint.run/docs/linters/configuration/#copyloopvar
7
+
- dogsled # Checks assignments with too many blank identifiers. https://golangci-lint.run/docs/linters/configuration/#dogsled
8
+
- dupword # Duplicate word. https://golangci-lint.run/docs/linters/configuration/#dupword
9
9
- goprintffuncname
10
10
- govet
11
11
- ineffassign
12
12
- misspell
13
13
- revive
14
-
- recvcheck # Checks for receiver type consistency. https://golangci-lint.run/usage/linters/#recvcheck
14
+
- recvcheck # Checks for receiver type consistency. https://golangci-lint.run/docs/linters/configuration/#recvcheck
15
15
- rowserrcheck # Checks whether Rows.Err of rows is checked successfully.
16
-
- errchkjson # Checks types passed to the json encoding functions. ref: https://golangci-lint.run/usage/linters/#errchkjson
17
-
- errorlint # Checking for unchecked errors in Go code https://golangci-lint.run/usage/linters/#errcheck
16
+
- errchkjson # Checks types passed to the json encoding functions. ref: https://golangci-lint.run/docs/linters/configuration/#errchkjson
17
+
- errorlint # Checking for unchecked errors in Go code https://golangci-lint.run/docs/linters/configuration/#errorlint
18
18
- staticcheck
19
19
- unconvert
20
20
- unused
21
-
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. https://golangci-lint.run/usage/linters/#usestdlibvars
21
+
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. https://golangci-lint.run/docs/linters/configuration/#usestdlibvars
22
22
- whitespace
23
-
- decorder # Check declaration order and count of types, constants, variables and functions. https://golangci-lint.run/usage/linters/#decorder
24
-
- tagalign # Check that struct tags are well aligned. https://golangci-lint.run/usage/linters/#tagalign
23
+
- decorder # Check declaration order and count of types, constants, variables and functions. https://golangci-lint.run/docs/linters/configuration/#decorder
24
+
- tagalign # Check that struct tags are well aligned. https://golangci-lint.run/docs/linters/configuration/#tagalign
25
25
- predeclared # Find code that shadows one of Go's predeclared identifiers
26
26
- sloglint # Ensure consistent code style when using log/slog
27
27
- asciicheck # Checks that all code identifiers does not have non-ASCII symbols in the name
28
-
- nilnil # Checks that there is no simultaneous return of nil error and an nil value. ref: https://golangci-lint.run/usage/linters/#nilnil
29
-
- nonamedreturns # Checks that functions with named return values do not return named values. https://golangci-lint.run/usage/linters/#nonamedreturns
30
-
- cyclop # Checks function and package cyclomatic complexity. https://golangci-lint.run/usage/linters/#cyclop
28
+
- nilnil # Checks that there is no simultaneous return of nil error and an nil value. ref: https://golangci-lint.run/docs/linters/configuration/#nilnil
29
+
- nonamedreturns # Checks that functions with named return values do not return named values. https://golangci-lint.run/docs/linters/configuration/#nonamedreturns
30
+
- cyclop # Checks function and package cyclomatic complexity. https://golangci-lint.run/docs/linters/configuration/#cyclop
31
31
- gocritic # Analyze source code for various issues, including bugs, performance hiccups, and non-idiomatic coding practices. https://golangci-lint.run/docs/linters/configuration/#gocritic
32
-
- gochecknoinits # Checks that there are no init() functions in the code. https://golangci-lint.run/usage/linters/#gochecknoinits
32
+
- gochecknoinits # Checks that there are no init() functions in the code. https://golangci-lint.run/docs/linters/configuration/#gochecknoinits
33
+
- goconst # Finds repeated strings that could be replaced by a constant. https://golangci-lint.run/docs/linters/configuration/#goconst
33
34
34
35
# tests
35
-
- testifylint # Checks usage of github.com/stretchr/testify. https://golangci-lint.run/usage/linters/#testifylint
36
+
- testifylint # Checks usage of github.com/stretchr/testify. https://golangci-lint.run/docs/linters/configuration/#testifylint
36
37
settings:
37
38
exhaustive:
38
39
default-signifies-exhaustive: false
@@ -44,6 +45,14 @@ linters:
44
45
disabled: true
45
46
cyclop: # Lower cyclomatic complexity threshold after the max complexity is lowered
46
47
max-complexity: 37# Controller/execute.go:147:1: calculated cyclomatic complexity for function buildProvider is 37
48
+
goconst:
49
+
min-occurrences: 3
50
+
# Ignore well-known DNS record types, boolean strings, and common values
51
+
ignore-string-values:
52
+
- "^(A|AAAA|ALIAS|CNAME|MX|NS|PTR|SRV|TXT)$"# DNS record types
53
+
- "^(true|false)$"# Boolean strings
54
+
- "^none$"# Common null/empty indicator
55
+
- "^(aws-sd|noop)$"# Registry types - can be ignored for consistency
47
56
testifylint:
48
57
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
0 commit comments