Skip to content

Commit 76c0aba

Browse files
committed
chore: update golangci
1 parent 58d2b7c commit 76c0aba

File tree

2 files changed

+87
-77
lines changed

2 files changed

+87
-77
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.3.3 # 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: 86 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,90 @@
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 variables that are used in a loop closure and should be copied
41-
- gochecknoglobals # Checks that no globals are present in Go code
42-
- gochecknoinits # Checks that no init functions are present in Go code
43-
- gocognit # Computes and checks the cognitive complexity of functions
44-
- goconst # Finds repeated strings that could be replaced by a constant
45-
- gocritic # The most opinionated Go source code linter
46-
- gocyclo # Computes and checks the cyclomatic complexity of functions
47-
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
48-
- 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+
- gocognit
17+
- goconst
18+
- gocritic
19+
- gocyclo
20+
- goprintffuncname
21+
- gosec
22+
- govet
23+
- ineffassign
24+
- misspell
25+
- nakedret
26+
- noctx
27+
- nolintlint
28+
- prealloc
4929
- revive
50-
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
51-
- gosec # Inspects source code for security problems
52-
- gosimple # Linter for Go source code that specializes in simplifying a code
53-
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
54-
- ineffassign # Detects when assignments to existing variables are not used
55-
- misspell # Finds commonly misspelled English words in comments
56-
- nakedret # Finds naked returns in functions greater than a specified function length
57-
- noctx # finds sending http request without context.Context
58-
- nolintlint # Reports ill-formed or insufficient nolint directives
59-
- prealloc # Finds slice declarations that could potentially be preallocated
60-
- staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
61-
- stylecheck # Stylecheck is a replacement for golint
62-
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
63-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
64-
- unconvert # Remove unnecessary type conversions
65-
- unparam # Reports unused function parameters
66-
- unused # Checks Go code for unused constants, variables, functions and types
67-
- whitespace # Tool for detection of leading and trailing whitespace
68-
69-
issues:
70-
exclude-dirs:
71-
- .github
72-
- .git
73-
exclude-rules:
74-
- path: _test\.go
75-
linters:
76-
- dupl
77-
- funlen
78-
- scopelint
79-
- gocognit
30+
- staticcheck
31+
- tparallel
32+
- unconvert
33+
- unparam
34+
- unused
35+
- whitespace
36+
settings:
37+
dupl:
38+
threshold: 100
39+
goconst:
40+
min-len: 2
41+
min-occurrences: 3
42+
gocyclo:
43+
min-complexity: 15
44+
godot:
45+
scope: declarations
46+
capital: true
47+
lll:
48+
line-length: 120
49+
misspell:
50+
locale: US
51+
nolintlint:
52+
require-specific: true
53+
prealloc:
54+
simple: true
55+
range-loops: true
56+
for-loops: true
57+
wsl:
58+
allow-assign-and-anything: true
59+
exclusions:
60+
generated: lax
61+
presets:
62+
- comments
63+
- common-false-positives
64+
- legacy
65+
- std-error-handling
66+
rules:
67+
- linters:
68+
- dupl
69+
- funlen
70+
- gocognit
71+
- scopelint
72+
path: _test\.go
73+
paths:
74+
- .github
75+
- .git
76+
- third_party$
77+
- builtin$
78+
- examples$
79+
formatters:
80+
enable:
81+
- gofmt
82+
- goimports
83+
exclusions:
84+
generated: lax
85+
paths:
86+
- .github
87+
- .git
88+
- third_party$
89+
- builtin$
90+
- examples$

0 commit comments

Comments
 (0)