Skip to content

Commit dbf5485

Browse files
ci: upgrade golangci-lint to v2.12.2 for Go 1.25 support
The previous golangci-lint v1.62.2 was built with Go 1.23 and fails on the go 1.25.0 directive required by betterleaks. Migrate .golangci.yml to the v2 config format (dead linters dropped by the migration tool), keep gating parity by disabling linters introduced after v1.62 and restricting staticcheck to SA checks, and fix the one new prealloc finding.
1 parent 1fa4ab6 commit dbf5485

3 files changed

Lines changed: 81 additions & 63 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
go install gotest.tools/gotestsum@latest
2626
2727
- name: Install golangci-lint
28-
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
28+
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
2929
with:
30-
version: v1.62.2
30+
version: v2.12.2
3131

3232
github-actions-docs:
3333
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 76 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,82 @@
1-
project_name: ld-find-code-refs
2-
1+
version: "2"
32
run:
4-
deadline: 120s
53
tests: false
6-
74
linters:
8-
enable-all: true
5+
default: all
96
disable:
10-
- golint
11-
- stylecheck
12-
- gochecknoglobals
13-
- lll
14-
- errcheck
15-
- interfacer
16-
- tagliatelle
17-
- varnamelen
18-
- nonamedreturns
19-
- nlreturn # re-enable this after fixing all cases
20-
- gomnd # re-enable this after fixing all cases
21-
- nosnakecase
22-
- ifshort # re-enable
23-
- nilerr #re-enable
24-
- goerr113
25-
- exhaustivestruct
26-
- exhaustruct
27-
- exhaustive
28-
- godot
29-
- wsl #fix
30-
- gocognit
31-
- revive
32-
- errname
33-
- cyclop
34-
- gofumpt # fix
35-
- gci
36-
- nestif # fix
37-
- gosec
38-
- gocritic
39-
- depguard
40-
- tagalign
41-
- nilnil
42-
fast: false
43-
44-
linter-settings:
45-
goimports:
46-
local-prefixes: github.com/launchdarkly,gopkg.in/launchdarkly
47-
7+
- cyclop
8+
- funcorder
9+
- godoclint
10+
- gomodguard
11+
- modernize
12+
- noinlineerr
13+
- wsl_v5
14+
- depguard
15+
- err113
16+
- errcheck
17+
- errname
18+
- exhaustive
19+
- exhaustruct
20+
- gochecknoglobals
21+
- gocognit
22+
- gocritic
23+
- godot
24+
- gosec
25+
- lll
26+
- mnd
27+
- nestif
28+
- nilerr
29+
- nilnil
30+
- nlreturn
31+
- nonamedreturns
32+
- revive
33+
- tagalign
34+
- tagliatelle
35+
- varnamelen
36+
- wsl
37+
settings:
38+
staticcheck:
39+
checks:
40+
- all
41+
- -ST*
42+
- -QF*
43+
exclusions:
44+
generated: lax
45+
rules:
46+
- linters:
47+
- staticcheck
48+
text: SA5011
49+
- path: (.+)\.go$
50+
text: error returned from external package is unwrapped
51+
- path: (.+)\.go$
52+
text: error returned from interface method should be wrapped
53+
- path: (.+)\.go$
54+
text: comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
55+
- path: (.+)\.go$
56+
text: comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error
57+
- path: (.+)\.go$
58+
text: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
59+
- path: (.+)\.go$
60+
text: append to slice `projectKeys` with non-zero initialized length
61+
paths:
62+
- third_party$
63+
- builtin$
64+
- examples$
4865
issues:
49-
exclude:
50-
- "error returned from external package is unwrapped"
51-
- "error returned from interface method should be wrapped"
52-
- "comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error" # should fix
53-
- "comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error" # should fix
54-
- "non-wrapping format verb for fmt.Errorf. Use `%w` to format errors" # should fix
55-
- "append to slice `projectKeys` with non-zero initialized length"
56-
exclude-rules:
57-
# Exclude some `staticcheck` messages.
58-
- linters:
59-
- staticcheck
60-
text: "SA5011" # fix
61-
62-
exclude-use-default: false
66+
max-issues-per-linter: 1000
6367
max-same-issues: 1000
64-
max-per-linter: 1000
68+
formatters:
69+
enable:
70+
- gofmt
71+
- goimports
72+
settings:
73+
goimports:
74+
local-prefixes:
75+
- github.com/launchdarkly
76+
- gopkg.in/launchdarkly
77+
exclusions:
78+
generated: lax
79+
paths:
80+
- third_party$
81+
- builtin$
82+
- examples$

search/delimiters.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
// Get a list of delimiters to use for flag key matching
99
// If defaults are disabled, only additional configured delimiters will be used
1010
func GetDelimiters(opts options.Options) []string {
11-
delims := []string{`"`, `'`, "`"}
12-
if opts.Delimiters.DisableDefaults {
13-
delims = []string{}
11+
delims := make([]string, 0, 3+len(opts.Delimiters.Additional)) //nolint:mnd
12+
if !opts.Delimiters.DisableDefaults {
13+
delims = append(delims, `"`, `'`, "`")
1414
}
1515

1616
delims = append(delims, opts.Delimiters.Additional...)

0 commit comments

Comments
 (0)