Skip to content

Commit 2830558

Browse files
chore(deps): update dependency golangci/golangci-lint to v2 (#338)
1 parent a5ac036 commit 2830558

File tree

3 files changed

+149
-122
lines changed

3 files changed

+149
-122
lines changed

.golangci.yml

Lines changed: 145 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,154 @@
11
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
2-
# docs: https://github.com/golangci/golangci-lint#config-file
2+
# docs: https://golangci-lint.run/usage/configuration/
3+
version: "2"
34

45
run:
5-
timeout: 2m
66
modules-download-mode: readonly
77
allow-parallel-runners: true
88

99
output:
10-
formats: [{format: colored-line-number}] # colored-line-number|line-number|json|tab|checkstyle|code-climate
10+
formats: {text: {path: stdout}}
1111

12-
linters-settings:
13-
gci:
14-
sections:
15-
- standard
16-
- default
17-
- prefix(gh.tarampamp.am/error-pages)
18-
gofmt:
19-
simplify: false
20-
rewrite-rules:
21-
- { pattern: 'interface{}', replacement: 'any' }
22-
govet:
23-
enable:
24-
- shadow
25-
gocyclo:
26-
min-complexity: 15
27-
godot:
28-
scope: declarations
29-
capital: false
30-
dupl:
31-
threshold: 100
32-
goconst:
33-
min-len: 2
34-
min-occurrences: 3
35-
misspell:
36-
locale: US
37-
ignore-words: [cancelled]
38-
lll:
39-
line-length: 120
40-
forbidigo:
41-
forbid:
42-
- '^(fmt\.Print(|f|ln)|print(|ln))(# it looks like a forgotten debugging printing call)?$'
43-
prealloc:
44-
simple: true
45-
range-loops: true
46-
for-loops: true
47-
nolintlint:
48-
require-specific: true
49-
nakedret:
50-
# Make an issue if func has more lines of code than this setting, and it has naked returns.
51-
# Default: 30
52-
max-func-lines: 100
53-
54-
linters: # All available linters list: <https://golangci-lint.run/usage/linters/>
55-
disable-all: true
12+
linters:
13+
default: none
5614
enable:
57-
- asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
58-
- bidichk # Checks for dangerous unicode character sequences
59-
- dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
60-
- dupl # Tool for code clone detection
61-
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
62-
- errorlint # find code that will cause problems with the error wrapping scheme introduced in Go 1.13
63-
- exhaustive # check exhaustiveness of enum switch statements
64-
- copyloopvar # detects places where loop variables are copied
65-
- funlen # Tool for detection of long functions
66-
- gci # Gci control golang package import order and make it always deterministic
67-
- godot # Check if comments end in a period
68-
- gochecknoglobals # Checks that no globals are present in Go code
69-
- gochecknoinits # Checks that no init functions are present in Go code
70-
- gocognit # Computes and checks the cognitive complexity of functions
71-
- goconst # Finds repeated strings that could be replaced by a constant
72-
- gocritic # The most opinionated Go source code linter
73-
- gocyclo # Computes and checks the cyclomatic complexity of functions
74-
- gofmt # Gofmt checks whether code was gofmt-ed. By default, this tool runs with -s option to check for code simplification
75-
- goimports # Goimports does everything that gofmt does. Additionally, it checks unused imports
76-
- mnd # An analyzer to detect magic numbers
77-
- goprintffuncname # Checks that printf-like functions are named with `f` at the end
78-
- gosec # Inspects source code for security problems
79-
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
80-
- ineffassign # Detects when assignments to existing variables are not used
81-
- lll # Reports long lines
82-
- forbidigo # Forbids identifiers
83-
- misspell # Finds commonly misspelled English words in comments
84-
- nakedret # Finds naked returns in functions greater than a specified function length
85-
- nestif # Reports deeply nested if statements
86-
- nlreturn # checks for a new line before return and branch statements to increase code clarity
87-
- nolintlint # Reports ill-formed or insufficient nolint directives
88-
- prealloc # Finds slice declarations that could potentially be preallocated
89-
- promlinter # Check Prometheus metrics naming via promlint.
90-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
91-
- unconvert # Remove unnecessary type conversions
92-
- whitespace # Tool for detection of leading and trailing whitespace
93-
- wsl # Whitespace Linter - Forces you to use empty lines!
94-
- unused # Checks Go code for unused constants, variables, functions and types
95-
- gosimple # Linter for Go source code that specializes in simplifying code
96-
- staticcheck # It's a set of rules from staticcheck
97-
- asasalint # Check for pass []any as any in variadic func(...any)
98-
- bodyclose # Checks whether HTTP response body is closed successfully
99-
- contextcheck # Check whether the function uses a non-inherited context
100-
- decorder # Check declaration order and count of types, constants, variables and functions
101-
- dupword # Checks for duplicate words in the source code
102-
- durationcheck # Check for two durations multiplied together
103-
- errchkjson # Checks types passed to the json encoding functions
104-
- errname # Checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
105-
106-
issues:
107-
exclude-dirs:
108-
- .github
109-
- .git
110-
- tmp
111-
- temp
112-
- testdata
113-
exclude-rules:
114-
- {path: flags\.go, linters: [gochecknoglobals, lll, mnd, dupl]}
115-
- {path: env\.go, linters: [lll, gosec]}
116-
- path: _test\.go
117-
linters:
118-
- dupl
119-
- dupword
120-
- lll
121-
- nolintlint
122-
- funlen
123-
- gocognit
124-
- noctx
125-
- goconst
126-
- nlreturn
127-
- gochecknoglobals
15+
- asasalint
16+
- asciicheck
17+
- bidichk
18+
- bodyclose
19+
- contextcheck
20+
- copyloopvar
21+
- decorder
22+
- dogsled
23+
- dupl
24+
- dupword
25+
- durationcheck
26+
- errcheck
27+
- errchkjson
28+
- errname
29+
- errorlint
30+
- exhaustive
31+
- forbidigo
32+
- funlen
33+
- gochecknoglobals
34+
- gochecknoinits
35+
- gocognit
36+
- goconst
37+
- gocritic
38+
- gocyclo
39+
- godot
40+
- goprintffuncname
41+
- gosec
42+
- govet
43+
- ineffassign
44+
- lll
45+
- misspell
46+
- mnd
47+
- nakedret
48+
- nestif
49+
- nlreturn
50+
- nolintlint
51+
- prealloc
52+
- promlinter
53+
- staticcheck
54+
- unconvert
55+
- unused
56+
- whitespace
57+
- wsl
58+
settings:
59+
dupl:
60+
threshold: 100
61+
forbidigo:
62+
forbid:
63+
- pattern: ^(fmt\.Print(|f|ln)|print(|ln))(# it looks like a forgotten debugging printing call)?$
64+
goconst:
65+
min-len: 2
66+
min-occurrences: 3
67+
gocyclo:
68+
min-complexity: 15
69+
godot:
70+
scope: declarations
71+
capital: false
72+
govet:
73+
enable:
74+
- shadow
75+
lll:
76+
line-length: 120
77+
misspell:
78+
locale: US
79+
ignore-rules:
80+
- cancelled
81+
nakedret:
82+
max-func-lines: 100
83+
nolintlint:
84+
require-specific: true
85+
prealloc:
86+
simple: true
87+
range-loops: true
88+
for-loops: true
89+
exclusions:
90+
generated: lax
91+
presets:
92+
- comments
93+
- common-false-positives
94+
- legacy
95+
- std-error-handling
96+
rules:
97+
- linters:
98+
- dupl
99+
- gochecknoglobals
100+
- lll
101+
- mnd
102+
path: flags\.go
103+
- linters:
104+
- gosec
105+
- lll
106+
path: env\.go
107+
- linters:
108+
- dupl
109+
- dupword
110+
- funlen
111+
- gochecknoglobals
112+
- gocognit
113+
- goconst
114+
- lll
115+
- nlreturn
116+
- noctx
117+
- nolintlint
118+
path: _test\.go
119+
paths:
120+
- .github
121+
- .git
122+
- tmp
123+
- temp
124+
- testdata
125+
- third_party$
126+
- builtin$
127+
- examples$
128+
formatters:
129+
enable:
130+
- gci
131+
- gofmt
132+
- goimports
133+
settings:
134+
gci:
135+
sections:
136+
- standard
137+
- default
138+
- prefix(gh.tarampamp.am/error-pages)
139+
gofmt:
140+
simplify: false
141+
rewrite-rules:
142+
- pattern: interface{}
143+
replacement: any
144+
exclusions:
145+
generated: lax
146+
paths:
147+
- .github
148+
- .git
149+
- tmp
150+
- temp
151+
- testdata
152+
- third_party$
153+
- builtin$
154+
- examples$

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENV GOPATH="/var/tmp/go"
88

99
RUN set -x \
1010
# renovate: source=github-releases name=golangci/golangci-lint
11-
&& GOLANGCI_LINT_VERSION="1.64.5" \
11+
&& GOLANGCI_LINT_VERSION="2.0.2" \
1212
&& wget -O- -nv "https://cdn.jsdelivr.net/gh/golangci/golangci-lint@v${GOLANGCI_LINT_VERSION}/install.sh" \
1313
| sh -s -- -b /bin "v${GOLANGCI_LINT_VERSION}"
1414

internal/http/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ func (s *Server) Register(cfg *config.Config) error {
9494

9595
// wrong requests handling
9696
default:
97-
switch {
98-
case method == fasthttp.MethodHead:
97+
switch method {
98+
case fasthttp.MethodHead:
9999
ctx.Error(notAllowed, fasthttp.StatusNotFound)
100-
case method == fasthttp.MethodGet:
100+
case fasthttp.MethodGet:
101101
ctx.Error(notFound, fasthttp.StatusNotFound)
102102
default:
103103
ctx.Error(notAllowed, fasthttp.StatusMethodNotAllowed)

0 commit comments

Comments
 (0)