Skip to content

Commit b7b689e

Browse files
committed
chore: update golangci
1 parent ab68ba0 commit b7b689e

File tree

4 files changed

+88
-78
lines changed

4 files changed

+88
-78
lines changed

.github/workflows/linters.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ jobs:
1616
go-version: stable
1717

1818
- name: Run linter
19-
uses: golangci/golangci-lint-action@v6.5.2 # Action page: <https://github.com/golangci/golangci-lint-action>
19+
uses: golangci/golangci-lint-action@v7 # Action page: <https://github.com/golangci/golangci-lint-action>
2020
with:
21-
version: v1.64 # without patch version
2221
only-new-issues: false # show only new issues if it's a pull request
2322
args: --timeout=10m --build-tags=race

.golangci.yml

Lines changed: 84 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,88 @@
1-
# Documentation: <https://github.com/golangci/golangci-lint#config-file>
2-
1+
version: "2"
32
run:
4-
timeout: 1m
53
allow-parallel-runners: true
6-
7-
linters-settings:
8-
wsl:
9-
allow-assign-and-anything: true
10-
gocyclo:
11-
min-complexity: 15
12-
godot:
13-
scope: declarations
14-
capital: true
15-
dupl:
16-
threshold: 100
17-
goconst:
18-
min-len: 2
19-
min-occurrences: 3
20-
misspell:
21-
locale: US
22-
lll:
23-
line-length: 120
24-
prealloc:
25-
simple: true
26-
range-loops: true
27-
for-loops: true
28-
nolintlint:
29-
require-specific: true
30-
31-
linters: # All available linters list: <https://golangci-lint.run/usage/linters/>
32-
disable-all: true
4+
linters:
5+
default: none
336
enable:
34-
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
35-
- bodyclose # Checks whether HTTP response body is closed successfully
36-
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
37-
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
38-
- errorlint # find code that will cause problems with the error wrapping scheme introduced in Go 1.13
39-
- exhaustive # check exhaustiveness of enum switch statements
40-
- copyloopvar # Checks for using loop variables in function literal closures
41-
- gochecknoglobals # Checks that no globals are present in Go code
42-
- gochecknoinits # Checks that no init functions are present in Go code
43-
- goconst # Finds repeated strings that could be replaced by a constant
44-
- gocritic # The most opinionated Go source code linter
45-
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
46-
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
7+
- asciicheck
8+
- bodyclose
9+
- copyloopvar
10+
- dogsled
11+
- errcheck
12+
- errorlint
13+
- exhaustive
14+
- gochecknoglobals
15+
- gochecknoinits
16+
- goconst
17+
- gocritic
18+
- goprintffuncname
19+
- gosec
20+
- govet
21+
- ineffassign
22+
- misspell
23+
- nakedret
24+
- noctx
25+
- nolintlint
26+
- prealloc
4727
- revive
48-
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
49-
- gosec # Inspects source code for security problems
50-
- gosimple # Linter for Go source code that specializes in simplifying a code
51-
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
52-
- ineffassign # Detects when assignments to existing variables are not used
53-
- misspell # Finds commonly misspelled English words in comments
54-
- nakedret # Finds naked returns in functions greater than a specified function length
55-
- noctx # finds sending http request without context.Context
56-
- nolintlint # Reports ill-formed or insufficient nolint directives
57-
- prealloc # Finds slice declarations that could potentially be preallocated
58-
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
59-
- stylecheck # Stylecheck is a replacement for golint
60-
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
61-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
62-
- unconvert # Remove unnecessary type conversions
63-
- unparam # Reports unused function parameters
64-
- unused # Checks Go code for unused constants, variables, functions and types
65-
- whitespace # Tool for detection of leading and trailing whitespace
66-
67-
issues:
68-
exclude-dirs:
69-
- .github
70-
- .git
71-
exclude-rules:
72-
- path: _test\.go
73-
linters:
74-
- dupl
75-
- funlen
76-
- scopelint
77-
- gocognit
28+
- staticcheck
29+
- tparallel
30+
- unconvert
31+
- unparam
32+
- unused
33+
- whitespace
34+
settings:
35+
dupl:
36+
threshold: 100
37+
goconst:
38+
min-len: 2
39+
min-occurrences: 3
40+
gocyclo:
41+
min-complexity: 15
42+
godot:
43+
scope: declarations
44+
capital: true
45+
lll:
46+
line-length: 120
47+
misspell:
48+
locale: US
49+
nolintlint:
50+
require-specific: true
51+
prealloc:
52+
simple: true
53+
range-loops: true
54+
for-loops: true
55+
wsl:
56+
allow-assign-and-anything: true
57+
exclusions:
58+
generated: lax
59+
presets:
60+
- comments
61+
- common-false-positives
62+
- legacy
63+
- std-error-handling
64+
rules:
65+
- linters:
66+
- dupl
67+
- funlen
68+
- gocognit
69+
- scopelint
70+
path: _test\.go
71+
paths:
72+
- .github
73+
- .git
74+
- third_party$
75+
- builtin$
76+
- examples$
77+
formatters:
78+
enable:
79+
- gofmt
80+
- goimports
81+
exclusions:
82+
generated: lax
83+
paths:
84+
- .github
85+
- .git
86+
- third_party$
87+
- builtin$
88+
- examples$

tests/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ require (
5757
go.uber.org/multierr v1.11.0 // indirect
5858
golang.org/x/sys v0.31.0 // indirect
5959
golang.org/x/text v0.23.0 // indirect
60-
google.golang.org/protobuf v1.36.5 // indirect
60+
google.golang.org/protobuf v1.36.6 // indirect
6161
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
6262
gopkg.in/yaml.v3 v3.0.1 // indirect
6363
)

tests/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
108108
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
109109
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
110110
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
111-
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
112-
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
111+
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
112+
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
113113
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
114114
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
115115
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

0 commit comments

Comments
 (0)