Skip to content

Commit 2356c69

Browse files
jorbaumchombium
authored andcommitted
Upgrade to golangci-lint v2 for improved linting
Noteworthy changes in golangci-lint v2: * New config format (migrated with `migrate` command) * Default timeout is now 0 instead of 1 minute. Also fixes issue reported by golangci-lint v2: * Same error string formatting.
1 parent 1ae5253 commit 2356c69

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

scripts/subtests/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set +e
99
golangci_lint_executable=$(which golangci-lint)
1010
set -e
1111
if [ -z "${golangci_lint_executable}" ] || [ ! -x "${golangci_lint_executable}" ]; then
12-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
12+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
1313
fi
1414

1515
pushd "${SCRIPT_DIR}/../../src" > /dev/null

src/.golangci.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
version: "2"
2+
13
run:
2-
# Timeout for analysis, e.g. 30s, 5m.
3-
# Default: 1m
4+
# Timeout full work, e.g. 30s, 5m.
5+
# Default: none
46
timeout: 5m
7+
58
linters:
69
enable:
710
# Checks for non-ASCII identifiers
@@ -10,9 +13,28 @@ linters:
1013
- gocyclo
1114
# Inspects source code for security problems.
1215
- gosec
16+
exclusions:
17+
generated: lax
18+
presets:
19+
- comments
20+
- common-false-positives
21+
- legacy
22+
- std-error-handling
23+
paths:
24+
- third_party$
25+
- builtin$
26+
- examples$
1327

1428
issues:
1529
# Disable max issues per linter.
1630
max-issues-per-linter: 0
1731
# Disable max same issues.
1832
max-same-issues: 0
33+
34+
formatters:
35+
exclusions:
36+
generated: lax
37+
paths:
38+
- third_party$
39+
- builtin$
40+
- examples$

src/internal/ingress/listener.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (l *StatsdListener) parseStat(data string) (*loggregator_v2.Envelope, error
9494
parts := statsdRegexp.FindStringSubmatch(data)
9595

9696
if len(parts) == 0 {
97-
return nil, fmt.Errorf("Input line '%s' was not a valid statsd line.", data)
97+
return nil, fmt.Errorf("input line '%s' was not a valid statsd line", data)
9898
}
9999

100100
// parts[0] is complete matched string

0 commit comments

Comments
 (0)