Skip to content

Commit 327ed65

Browse files
authored
Merge pull request #150 from bsv-blockchain/task/update-golangci-lint-to-v2
[Task] update golangci-lint to v2
2 parents d0d0b96 + 5204567 commit 327ed65

File tree

3 files changed

+141
-198
lines changed

3 files changed

+141
-198
lines changed

.github/workflows/check_branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ permissions:
1212

1313
jobs:
1414
on-push:
15-
uses: bactions/workflows/.github/workflows/on-push-go.yml@main
15+
uses: bactions/workflows/.github/workflows/on-push-go.yml@v2
1616
secrets:
1717
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}

.golangci-lint.yml

Lines changed: 73 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# This file contains all available configuration options
2-
# with their default values.
1+
version: "2"
32

43
# options for analysis running
54
run:
6-
# timeout for analysis, e.g. 30s, 5m, default is 1m
7-
timeout: 5m
8-
95
# exit code when at least one issue was found, default is 1
106
issues-exit-code: 1
117

@@ -28,128 +24,90 @@ run:
2824

2925
# output configuration options
3026
output:
27+
# formats is now a mapping by format type (e.g., "text") — not a list
3128
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
3229
formats:
33-
- format: colored-line-number
30+
text:
3431
path: stdout
35-
36-
# print lines of code with issue, default is true
37-
print-issued-lines: true
38-
39-
# print linter name in the end of issue text, default is true
40-
print-linter-name: true
32+
# print lines of code with issue, default is true
33+
print-linter-name: true
34+
# print linter name in the end of issue text, default is true
35+
print-issued-lines: true
4136

4237
# add a prefix to the output file references; default is no prefix
4338
path-prefix: ""
44-
4539
linters:
46-
# Disable all linters.
47-
# Default: false
48-
disable-all: true
49-
# Enable specific linter
40+
# "disable-all: true" → replaced with "default: none"
41+
default: none
42+
# Enabled linters — migrated as-is
5043
# https://golangci-lint.run/usage/linters/#enabled-by-default
5144
enable:
5245
- bodyclose
46+
- copyloopvar
47+
- dogsled
48+
- errcheck
49+
- errorlint
5350
- exhaustive
5451
- gosec
55-
- prealloc
5652
- govet
57-
- revive
58-
- unconvert
5953
- ineffassign
60-
- dogsled
61-
- copyloopvar
62-
- sqlclosecheck
6354
- nolintlint
64-
- errcheck
65-
- gosimple
55+
- prealloc
56+
- revive
57+
- sqlclosecheck
6658
- staticcheck
59+
- unconvert
6760
- unused
68-
- wrapcheck
69-
- errorlint
7061
- wastedassign
71-
72-
linters-settings:
73-
revive:
62+
- wrapcheck
63+
settings:
64+
revive:
65+
rules:
66+
- name: exported
67+
exclude:
68+
- '**/testabilities/**'
69+
- '**/internal/**'
70+
exclusions:
71+
generated: lax
7472
rules:
75-
- name: exported
76-
exclude:
77-
- "**/testabilities/**"
78-
- "**/internal/**"
79-
73+
- linters:
74+
- bodyclose
75+
- errcheck
76+
- gosec
77+
- wrapcheck
78+
path: _test\.go
79+
- linters:
80+
- bodyclose
81+
- gosec
82+
- wrapcheck
83+
path: /testabilities/
84+
- linters:
85+
- gosec
86+
path: internal/hmac/
87+
text: weak cryptographic primitive
88+
- linters:
89+
- wrapcheck
90+
path: test/mocks
91+
- linters:
92+
- staticcheck
93+
text: 'SA1019:'
94+
- linters:
95+
- lll
96+
source: '^//go:generate '
97+
- path: (.+)\.go$
98+
text: Using the variable on range scope .* in function literal
99+
- path: (.+)\.go$
100+
text: should have a package comment
101+
paths:
102+
- .*\.my\.go$
103+
- lib/bad.go
104+
- .github
105+
- .make
106+
- dist
107+
- third_party$
108+
- builtin$
109+
- examples$
80110
issues:
81-
# List of regexps of issue texts to exclude, empty list by default.
82-
# But independently of this option we use default exclude patterns,
83-
# it can be disabled by `exclude-use-default: false`. To list all
84-
# excluded by default patterns execute `golangci-lint run --help`
85-
exclude:
86-
- Using the variable on range scope .* in function literal
87-
- should have a package comment
88-
89-
# Excluding configuration per-path, per-linter, per-text and per-source
90-
exclude-rules:
91-
# Exclude some linters from running on tests files.
92-
- path: _test\.go
93-
linters:
94-
- errcheck
95-
- gosec
96-
- wrapcheck
97-
- bodyclose
98-
99-
- path: /testabilities/
100-
linters:
101-
- gosec
102-
- wrapcheck
103-
- bodyclose
104-
105-
# Exclude known linters from partially "hard-vendored" code,
106-
# which is impossible to exclude via "nolint" comments.
107-
- path: internal/hmac/
108-
text: "weak cryptographic primitive"
109-
linters:
110-
- gosec
111-
112-
# Exclude some linters from running on mocks.
113-
- path: test/mocks
114-
linters:
115-
- wrapcheck
116-
117-
# Exclude some "staticcheck" messages
118-
- linters:
119-
- staticcheck
120-
text: "SA1019:"
121-
122-
# Exclude lll issues for long lines with go:generate
123-
- linters:
124-
- lll
125-
source: "^//go:generate "
126-
127-
# Independently of option `exclude` we use default exclude patterns,
128-
# it can be disabled by this option. To list all
129-
# excluded by default patterns execute `golangci-lint run --help`.
130-
# Default value for this option is true.
131-
exclude-use-default: false
132-
133-
# which files to skip: they will be analyzed, but issues from them
134-
# won't be reported. Default value is empty list, but there is
135-
# no need to include all autogenerated files, we confidently recognize
136-
# autogenerated files. If it's not please let us know.
137-
# "/" will be replaced by current OS file path separator to properly work
138-
# on Windows.
139-
exclude-files:
140-
- ".*\\.my\\.go$"
141-
- lib/bad.go
142-
# which dirs to skip: issues from them won't be reported;
143-
# can use regexp here: generated.*, regexp is applied on full path;
144-
# default value is empty list, but default dirs are skipped independently
145-
# of this option's value (see skip-dirs-use-default).
146-
# "/" will be replaced by current OS file path separator to properly work
147-
# on Windows.
148-
exclude-dirs:
149-
- .github
150-
- .make
151-
- dist
152-
153111
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
154112
max-issues-per-linter: 0
155113

@@ -158,28 +116,16 @@ issues:
158116

159117
# Show only new issues created after git revision `REV`
160118
new-from-rev: ""
161-
162119
severity:
163-
# Default value is empty string.
164-
# Set the default severity for issues. If severity rules are defined and the issues
165-
# do not match or no severity is provided to the rule this will be the default
166-
# severity applied. Severities should match the supported severity names of the
167-
# selected out format.
168-
# - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity
169-
# - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity
170-
# - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
171-
default-severity: error
172-
173-
# The default value is false.
174-
# If set to true severity-rules regular expressions become case-sensitive.
175-
case-sensitive: false
176-
177-
# Default value is empty list.
178-
# When a list of severity rules are provided, severity information will be added to lint
179-
# issues. Severity rules have the same filtering capability as exclude rules except you
180-
# are allowed to specify one matcher per severity rule.
181-
# Only affects out formats that support setting severity information.
120+
default: error
182121
rules:
183122
- linters:
184123
- dupl
185124
severity: info
125+
formatters:
126+
exclusions:
127+
generated: lax
128+
paths:
129+
- third_party$
130+
- builtin$
131+
- examples$

0 commit comments

Comments
 (0)