Skip to content

Commit 604eb72

Browse files
committed
chore: update linter
1 parent 849740b commit 604eb72

File tree

4 files changed

+69
-68
lines changed

4 files changed

+69
-68
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and test
33
on: [push, pull_request]
44

55
env:
6-
GOLANGCI_LINT_VERSION: v1.63.4
6+
GOLANGCI_LINT_VERSION: v2.0.2
77

88
jobs:
99
build:
@@ -25,7 +25,7 @@ jobs:
2525
git diff --exit-code go.sum
2626
2727
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
28-
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
28+
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
2929

3030
- name: Install Compose
3131
uses: ndeloof/install-compose-action@v0.0.1

.golangci.yml

Lines changed: 64 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
version: "2"
2+
3+
formatters:
4+
enable:
5+
- gci
6+
- gofumpt
7+
settings:
8+
gofumpt:
9+
extra-rules: false
10+
111
linters:
2-
disable-all: true
12+
default: none
313
enable:
414
- asasalint
515
- asciicheck
@@ -8,30 +18,25 @@ linters:
818
- depguard
919
- dogsled
1020
- durationcheck
21+
- err113
1122
- errcheck
1223
- errname
1324
- errorlint
1425
- forbidigo
1526
- forcetypeassert
1627
- funlen
17-
- gci
1828
- gochecknoglobals
1929
- gocognit
2030
- goconst
2131
- gocritic
2232
- gocyclo
2333
- godot
2434
- godox
25-
- err113
26-
- gofmt
27-
- gofumpt
2835
- goheader
29-
- goimports
3036
- gomoddirectives
3137
- gomodguard
3238
- goprintffuncname
3339
- gosec
34-
- gosimple
3540
- govet
3641
- importas
3742
- ineffassign
@@ -46,9 +51,7 @@ linters:
4651
- promlinter
4752
- revive
4853
- staticcheck
49-
- stylecheck
5054
- tagliatelle
51-
- tenv
5255
- thelper
5356
- unconvert
5457
- unparam
@@ -57,64 +60,60 @@ linters:
5760
- wastedassign
5861
- whitespace
5962

60-
linters-settings:
61-
govet:
62-
enable-all: true
63-
disable:
64-
- fieldalignment
65-
gocyclo:
66-
min-complexity: 15
67-
goconst:
68-
min-len: 5
69-
min-occurrences: 3
70-
misspell:
71-
locale: US
72-
funlen:
73-
lines: -1
74-
statements: 40
75-
godox:
76-
keywords:
77-
- FIXME
78-
gofumpt:
79-
extra-rules: false
80-
depguard:
63+
settings:
64+
depguard:
65+
rules:
66+
main:
67+
deny:
68+
- pkg: github.com/instana/testify
69+
desc: not allowed
70+
- pkg: github.com/sirupsen/logrus
71+
desc: not allowed
72+
- pkg: github.com/pkg/errors
73+
desc: Should be replaced by standard lib errors package
74+
funlen:
75+
lines: -1
76+
statements: 40
77+
goconst:
78+
min-len: 5
79+
min-occurrences: 3
80+
gocritic:
81+
disabled-checks:
82+
- unnamedResult
83+
- sloppyReassign
84+
- rangeValCopy
85+
- octalLiteral
86+
- paramTypeCombine # already handle by gofumpt.extra-rules
87+
enabled-tags:
88+
- diagnostic
89+
- style
90+
- performance
91+
settings:
92+
hugeParam:
93+
sizeThreshold: 100
94+
gocyclo:
95+
min-complexity: 15
96+
godox:
97+
keywords:
98+
- FIXME
99+
gosec:
100+
excludes:
101+
- G115
102+
govet:
103+
disable:
104+
- fieldalignment
105+
enable-all: true
106+
misspell:
107+
locale: US
108+
109+
exclusions:
110+
warn-unused: true
81111
rules:
82-
main:
83-
deny:
84-
- pkg: "github.com/instana/testify"
85-
desc: not allowed
86-
- pkg: "github.com/sirupsen/logrus"
87-
desc: not allowed
88-
- pkg: "github.com/pkg/errors"
89-
desc: Should be replaced by standard lib errors package
90-
gocritic:
91-
enabled-tags:
92-
- diagnostic
93-
- style
94-
- performance
95-
disabled-checks:
96-
- unnamedResult
97-
- sloppyReassign
98-
- rangeValCopy
99-
- octalLiteral
100-
- paramTypeCombine # already handle by gofumpt.extra-rules
101-
settings:
102-
hugeParam:
103-
sizeThreshold: 100
104-
gosec:
105-
excludes:
106-
- G115
112+
- linters:
113+
- funlen
114+
- goconst
115+
path: (.+)_test.go
107116

108117
issues:
109-
exclude-use-default: false
110118
max-issues-per-linter: 0
111119
max-same-issues: 0
112-
exclude: [ ]
113-
exclude-rules:
114-
- path: "(.+)_test.go"
115-
linters:
116-
- goconst
117-
- funlen
118-
119-
run:
120-
timeout: 5m

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/kvtools/zookeeper
22

3-
go 1.19
3+
go 1.22
44

55
require (
66
github.com/go-zookeeper/zk v1.0.4

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
44
github.com/go-zookeeper/zk v1.0.4 h1:DPzxraQx7OrPyXq2phlGlNSIyWEsAox0RJmjTseMV6I=
55
github.com/go-zookeeper/zk v1.0.4/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw=
66
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
7+
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
78
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
89
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
910
github.com/kvtools/valkeyrie v1.0.0 h1:LAITop2wPoYCMitR24GZZsW0b57hmI+ePD18VRTtOf0=
@@ -14,5 +15,6 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
1415
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
1516
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1617
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
18+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1719
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
1820
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)