Skip to content

Commit 6253382

Browse files
committed
chore: update linter
1 parent 0c68cfc commit 6253382

4 files changed

Lines changed: 74 additions & 75 deletions

File tree

.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: 62 additions & 63 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
@@ -9,30 +19,24 @@ linters:
919
- depguard
1020
- dogsled
1121
- durationcheck
22+
- err113
1223
- errcheck
1324
- errname
14-
# - errorlint # TODO can be used in future. Required to check the current reported issues.
1525
- forbidigo
1626
- forcetypeassert
1727
- funlen
18-
- gci
1928
- gochecknoglobals
2029
- gocognit
2130
- goconst
2231
- gocritic
2332
- gocyclo
2433
- godot
2534
- godox
26-
- err113
27-
- gofmt
28-
- gofumpt
2935
- goheader
30-
- goimports
3136
- gomoddirectives
3237
- gomodguard
3338
- goprintffuncname
3439
- gosec
35-
- gosimple
3640
- govet
3741
- importas
3842
- ineffassign
@@ -47,72 +51,67 @@ linters:
4751
- promlinter
4852
- revive
4953
- staticcheck
50-
- stylecheck
5154
- tagliatelle
52-
- tenv
5355
- thelper
5456
- unconvert
5557
- unparam
5658
- unused
5759
- usestdlibvars
5860
- wastedassign
5961
- whitespace
62+
# - errorlint # TODO can be used in future. Required to check the current reported issues.
63+
64+
settings:
65+
depguard:
66+
rules:
67+
main:
68+
deny:
69+
- pkg: github.com/instana/testify
70+
desc: not allowed
71+
- pkg: github.com/sirupsen/logrus
72+
desc: not allowed
73+
- pkg: github.com/pkg/errors
74+
desc: Should be replaced by standard lib errors package
75+
funlen:
76+
lines: -1
77+
statements: 40
78+
goconst:
79+
min-len: 5
80+
min-occurrences: 3
81+
gocritic:
82+
disabled-checks:
83+
- unnamedResult
84+
- sloppyReassign
85+
- rangeValCopy
86+
- octalLiteral
87+
- paramTypeCombine # already handle by gofumpt.extra-rules
88+
enabled-tags:
89+
- diagnostic
90+
- style
91+
- performance
92+
settings:
93+
hugeParam:
94+
sizeThreshold: 100
95+
gocyclo:
96+
min-complexity: 15
97+
godox:
98+
keywords:
99+
- FIXME
100+
govet:
101+
disable:
102+
- fieldalignment
103+
enable-all: true
104+
misspell:
105+
locale: US
60106

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

106115
issues:
107-
exclude-use-default: false
108116
max-issues-per-linter: 0
109117
max-same-issues: 0
110-
exclude: [ ]
111-
exclude-rules:
112-
- path: "(.+)_test.go"
113-
linters:
114-
- goconst
115-
- funlen
116-
117-
run:
118-
timeout: 5m

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module github.com/kvtools/etcdv2
22

3-
go 1.22.0
3+
go 1.23.0
44

55
require (
66
github.com/kvtools/valkeyrie v1.0.0
77
github.com/stretchr/testify v1.10.0
8-
go.etcd.io/etcd/client/v2 v2.305.17
8+
go.etcd.io/etcd/client/v2 v2.305.20
99
)
1010

1111
require (
@@ -16,7 +16,7 @@ require (
1616
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
1717
github.com/modern-go/reflect2 v1.0.2 // indirect
1818
github.com/pmezard/go-difflib v1.0.0 // indirect
19-
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
20-
go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect
19+
go.etcd.io/etcd/api/v3 v3.5.20 // indirect
20+
go.etcd.io/etcd/client/pkg/v3 v3.5.20 // indirect
2121
gopkg.in/yaml.v3 v3.0.1 // indirect
2222
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
2424
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
2525
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
2626
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
27-
go.etcd.io/etcd/api/v3 v3.5.17 h1:cQB8eb8bxwuxOilBpMJAEo8fAONyrdXTHUNcMd8yT1w=
28-
go.etcd.io/etcd/api/v3 v3.5.17/go.mod h1:d1hvkRuXkts6PmaYk2Vrgqbv7H4ADfAKhyJqHNLJCB4=
29-
go.etcd.io/etcd/client/pkg/v3 v3.5.17 h1:XxnDXAWq2pnxqx76ljWwiQ9jylbpC4rvkAeRVOUKKVw=
30-
go.etcd.io/etcd/client/pkg/v3 v3.5.17/go.mod h1:4DqK1TKacp/86nJk4FLQqo6Mn2vvQFBmruW3pP14H/w=
31-
go.etcd.io/etcd/client/v2 v2.305.17 h1:ajFukQfI//xY5VuSeuUw4TJ4WnNR2kAFfV/P0pDdPMs=
32-
go.etcd.io/etcd/client/v2 v2.305.17/go.mod h1:EttKgEgvwikmXN+b7pkEWxDZr6sEaYsqCiS3k4fa/Vg=
27+
go.etcd.io/etcd/api/v3 v3.5.20 h1:aKfz3nPZECWoZJXMSH9y6h2adXjtOHaHTGEVCuCmaz0=
28+
go.etcd.io/etcd/api/v3 v3.5.20/go.mod h1:QqKGViq4KTgOG43dr/uH0vmGWIaoJY3ggFi6ZH0TH/U=
29+
go.etcd.io/etcd/client/pkg/v3 v3.5.20 h1:sZIAtra+xCo56gdf6BR62to/hiie5Bwl7hQIqMzVTEM=
30+
go.etcd.io/etcd/client/pkg/v3 v3.5.20/go.mod h1:qaOi1k4ZA9lVLejXNvyPABrVEe7VymMF2433yyRQ7O0=
31+
go.etcd.io/etcd/client/v2 v2.305.20 h1:3nOyi6p2NQsgPIIXXEhxYEvyW62h94Q0DsMiKHeApvE=
32+
go.etcd.io/etcd/client/v2 v2.305.20/go.mod h1:elQUPzRTJKHQn4nGYlempVfkKEd+zxIEHDoW0OaudYs=
3333
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3434
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
3535
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

0 commit comments

Comments
 (0)