Skip to content

Commit 0a15228

Browse files
authored
Update golangci-lint-action (#2891)
* Update golangci-lint-action * Update golangci-lint * Update lint config
1 parent cc2e00a commit 0a15228

File tree

2 files changed

+52
-79
lines changed

2 files changed

+52
-79
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
with:
2222
go-version: '1.23'
2323
- name: golangci-lint-libs
24-
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3.7.1
24+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
2525
with:
2626
working-directory: libs
27-
version: v1.64.8
27+
version: v2.2.2
2828
args: --timeout 3m
2929

3030
golangci-services:
@@ -36,10 +36,10 @@ jobs:
3636
with:
3737
go-version: '1.23'
3838
- name: golangci-lint-services
39-
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3.7.1
39+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
4040
with:
4141
working-directory: services
42-
version: v1.64.8
42+
version: v2.2.2
4343
args: --timeout 3m
4444

4545
golangci-tools:
@@ -51,10 +51,10 @@ jobs:
5151
with:
5252
go-version: '1.23'
5353
- name: golangci-lint-tools
54-
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3.7.1
54+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
5555
with:
5656
working-directory: tools
57-
version: v1.64.8
57+
version: v2.2.2
5858
args: --timeout 3m
5959

6060
golangci-cmd:
@@ -66,10 +66,10 @@ jobs:
6666
with:
6767
go-version: '1.23'
6868
- name: golangci-lint-cmd
69-
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3.7.1
69+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
7070
with:
7171
working-directory: cmd
72-
version: v1.64.8
72+
version: v2.2.2
7373
args: --timeout 3m
7474

7575
golangci-main:
@@ -81,8 +81,8 @@ jobs:
8181
with:
8282
go-version: '1.23'
8383
- name: golangci-lint-main
84-
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v3.7.1
84+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
8585
with:
8686
working-directory: main
87-
version: v1.64.8
87+
version: v2.2.2
8888
args: --timeout 3m

.golangci.yaml

Lines changed: 42 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,46 @@
1+
version: "2"
12
run:
23
go: "1.23"
3-
timeout: 3m
4-
5-
linters-settings:
6-
cyclop:
7-
# The maximal code complexity to report.
8-
# Default: 10
9-
max-complexity: 10
10-
# The maximal average package complexity.
11-
# If it's higher than 0.0 (float) the check is enabled
12-
# Default: 0.0
13-
package-average: 10.0
14-
15-
errcheck:
16-
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
17-
# Such cases aren't reported by default.
18-
# Default: false
19-
check-type-assertions: true
20-
21-
gocritic:
22-
# Settings passed to gocritic.
23-
# The settings key is the name of a supported gocritic checker.
24-
# The list of supported checkers can be find in https://go-critic.github.io/overview.
25-
settings:
26-
captLocal:
27-
# Whether to restrict checker to params only.
28-
# Default: true
29-
paramsOnly: false
30-
underef:
31-
# Whether to skip (*x).method() calls where x is a pointer receiver.
32-
# Default: true
33-
skipRecvDeref: false
34-
35-
revive:
36-
rules:
37-
- name: if-return
38-
disabled: true
39-
40-
- name: unused-parameter
41-
disabled: true
42-
43-
varcheck:
44-
# Check usage of exported fields and variables.
45-
# Default: false
46-
exported-fields: true
47-
484
linters:
49-
disable-all: true
5+
default: none
506
enable:
51-
## enabled by default
52-
- unused # Finds unused code
53-
# - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
54-
# - gosimple # Linter for Go source code that specializes in simplifying a code
55-
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
56-
- ineffassign # Detects when assignments to existing variables are not used
57-
# - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
58-
# - structcheck # Finds unused struct fields
59-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
60-
# - unused # Checks Go code for unused constants, variables, functions and types
61-
# - varcheck # Finds unused global variables and constants
62-
# ## disabled by default
63-
# - contextcheck # check the function whether use a non-inherited context
64-
# - cyclop # checks function and package cyclomatic complexity
65-
# - errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error.
66-
# - gocritic # Provides diagnostics that check for bugs, performance and style issues.
67-
# - gocyclo # Computes and checks the cyclomatic complexity of functions
68-
# - nestif # Reports deeply nested if statements
69-
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go. Drop-in replacement of golint.
70-
# - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed
71-
# - stylecheck # Stylecheck is a replacement for golint
72-
# - wastedassign # wastedassign finds wasted assignment statements.
73-
# - whitespace # Tool for detection of leading and trailing whitespace
7+
- govet
8+
- ineffassign
9+
- revive
10+
- unused
11+
settings:
12+
cyclop:
13+
max-complexity: 10
14+
package-average: 10
15+
errcheck:
16+
check-type-assertions: true
17+
gocritic:
18+
settings:
19+
captLocal:
20+
paramsOnly: false
21+
underef:
22+
skipRecvDeref: false
23+
revive:
24+
rules:
25+
- name: if-return
26+
disabled: true
27+
- name: unused-parameter
28+
disabled: true
29+
exclusions:
30+
generated: lax
31+
presets:
32+
- comments
33+
- common-false-positives
34+
- legacy
35+
- std-error-handling
36+
paths:
37+
- third_party$
38+
- builtin$
39+
- examples$
40+
formatters:
41+
exclusions:
42+
generated: lax
43+
paths:
44+
- third_party$
45+
- builtin$
46+
- examples$

0 commit comments

Comments
 (0)