Skip to content

Commit 7d001a1

Browse files
chore(deps): update dependency golangci-lint to v2 (#32)
* chore(deps): update dependency golangci-lint to v2 * fix: linter --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Alec Thomas <alec@swapoff.org>
1 parent 390ae5f commit 7d001a1

File tree

4 files changed

+124
-4
lines changed

4 files changed

+124
-4
lines changed

.golangci.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: "2"
2+
run:
3+
tests: true
4+
output:
5+
show-stats: false
6+
formats:
7+
text:
8+
print-issued-lines: false
9+
colors: true
10+
linters:
11+
default: all
12+
disable:
13+
- cyclop
14+
- depguard
15+
- dupword
16+
- err113
17+
- errname
18+
- errorlint
19+
- exhaustruct
20+
- forbidigo
21+
- forcetypeassert
22+
- funlen
23+
- gochecknoglobals
24+
- gocognit
25+
- gocritic
26+
- gocyclo
27+
- godot
28+
- godox
29+
- gomoddirectives
30+
- ireturn
31+
- lll
32+
- maintidx
33+
- mnd
34+
- nakedret
35+
- nestif
36+
- nilnil
37+
- nlreturn
38+
- nolintlint
39+
- nonamedreturns
40+
- paralleltest
41+
- perfsprint
42+
- predeclared
43+
- recvcheck
44+
- revive
45+
- testpackage
46+
- varnamelen
47+
- wastedassign
48+
- whitespace
49+
- wsl
50+
- wsl_v5
51+
- funcorder
52+
- noinlineerr
53+
- tagalign
54+
- goconst
55+
- gochecknoinits
56+
- durationcheck
57+
- embeddedstructfieldcheck
58+
- copyloopvar
59+
- intrange
60+
settings:
61+
dupl:
62+
threshold: 100
63+
exhaustive:
64+
default-signifies-exhaustive: true
65+
goconst:
66+
min-len: 8
67+
min-occurrences: 3
68+
gocyclo:
69+
min-complexity: 10
70+
wrapcheck:
71+
report-internal-errors: false
72+
ignore-package-globs:
73+
- github.com/alecthomas/errors
74+
exclusions:
75+
generated: lax
76+
rules:
77+
- path: (.+)\.go$
78+
text: "^(G104|G204|G307|G304):"
79+
- path: (.+)\.go$
80+
text: Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
81+
- path: (.+)\.go$
82+
text: exported method `(.*\.MarshalJSON|.*\.UnmarshalJSON|.*\.EntityURN|.*\.GoString|.*\.Pos)` should have comment or be unexported
83+
- path: (.+)\.go$
84+
text: uses unkeyed fields
85+
- path: (.+)\.go$
86+
text: declaration of "err" shadows declaration
87+
- path: (.+)\.go$
88+
text: bad syntax for struct tag key
89+
- path: (.+)\.go$
90+
text: bad syntax for struct tag pair
91+
- path: (.+)\.go$
92+
text: ^ST1012
93+
- path: (.+)\.go$
94+
text: log/slog.Logger.*must not be called
95+
- path: (.+)_test\.go$
96+
text: error returned from external package is unwrapped
97+
- linters: [staticcheck]
98+
text: QF1008
99+
- text: "Error return value of `.*.Write` is not checked"
100+
linters: [errcheck]
101+
path: (.+)_test\.go$
102+
paths:
103+
- third_party$
104+
- builtin$
105+
- examples$
106+
issues:
107+
max-issues-per-linter: 0
108+
max-same-issues: 0
109+
formatters:
110+
enable:
111+
- gofmt
112+
- goimports
113+
exclusions:
114+
generated: lax
115+
paths:
116+
- third_party$
117+
- builtin$
118+
- examples$

bin/golangci-lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.golangci-lint-1.64.8.pkg
1+
.golangci-lint-2.5.0.pkg

repr.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (p *Printer) Println(vs ...any) {
184184
}
185185
p.reprValue(map[reflect.Value]bool{}, reflect.ValueOf(v), "", true, false)
186186
}
187-
fmt.Fprintln(p.w)
187+
_, _ = fmt.Fprintln(p.w)
188188
}
189189

190190
// showType is true if struct types should be shown. isAnyValue is true if the containing value is an "any" type.
@@ -209,7 +209,7 @@ func (p *Printer) reprValue(seen map[reflect.Value]bool, v reflect.Value, indent
209209

210210
// If we can't access a private field directly with reflection, try and do so via unsafe.
211211
if !v.CanInterface() && v.CanAddr() {
212-
uv := reflect.NewAt(t, unsafe.Pointer(v.UnsafeAddr())).Elem()
212+
uv := reflect.NewAt(t, unsafe.Pointer(v.UnsafeAddr())).Elem() //nolint
213213
if uv.CanInterface() {
214214
v = uv
215215
}
@@ -438,7 +438,7 @@ func timeToGo(w io.Writer, t time.Time) {
438438
zone = "nil"
439439
case time.UTC:
440440
zone = "time.UTC"
441-
case time.Local:
441+
case time.Local: //nolint
442442
zone = "time.Local"
443443
default:
444444
n, off := t.Zone()
@@ -476,6 +476,8 @@ func substAny(t reflect.Type) string {
476476
return "func" + t.Name() + "(" + strings.Join(in, ", ") + ")"
477477
}
478478
return "func" + t.Name() + "(" + strings.Join(in, ", ") + ") (" + strings.Join(out, ", ") + ")"
479+
480+
default:
479481
}
480482

481483
if t == anyType {

0 commit comments

Comments
 (0)