Skip to content

Commit 525d4b2

Browse files
committed
Migrate config to v2
1 parent e056c7b commit 525d4b2

File tree

2 files changed

+32
-59
lines changed

2 files changed

+32
-59
lines changed

.golangci.yml

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,31 @@
1-
# https://golangci-lint.run/usage/configuration
2-
1+
version: "2"
32
run:
4-
timeout: 5m
5-
tests: true
63
concurrency: 4
7-
skip-dirs:
8-
- "../../go/pkg/mod"
9-
4+
tests: true
105
linters:
116
enable:
12-
- govet
13-
- errcheck
14-
- staticcheck
15-
- revive
16-
- ineffassign
17-
- unused
18-
- misspell
19-
- nakedret
207
- bodyclose
218
- gocritic
22-
- makezero
239
- gosec
24-
25-
settings:
26-
staticcheck:
27-
checks:
28-
- all
29-
- "-QF1008" # Allow embedded structs to be referenced by field
30-
- "-ST1000" # Do not require package comments
31-
revive:
32-
rules:
33-
- name: exported
34-
disabled: true
35-
- name: exported
36-
disabled: true
37-
- name: package-comments
38-
disabled: true
10+
- makezero
11+
- misspell
12+
- nakedret
13+
- revive
3914
exclusions:
15+
generated: lax
16+
presets:
17+
- comments
18+
- common-false-positives
19+
- legacy
20+
- std-error-handling
4021
paths:
41-
- vendor
42-
- .git
43-
- .vscode
44-
- .idea
45-
- .DS_Store
46-
- go.sum
47-
- go.mod
48-
- LICENSE
49-
- README.md
50-
22+
- third_party$
23+
- builtin$
24+
- examples$
5125
formatters:
52-
enable:
53-
- gofmt
54-
- goimports
55-
56-
output:
57-
formats:
58-
text:
59-
print-linter-name: true
60-
print-issued-lines: true
26+
exclusions:
27+
generated: lax
28+
paths:
29+
- third_party$
30+
- builtin$
31+
- examples$

script/lint

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
#!/usr/bin/env bash
1+
set -eu
22

3-
set -eEuo pipefail
4-
PROJECT_DIR="$( cd "$( dirname "$0" )/.." && pwd )"
3+
# first run go fmt
4+
gofmt -s -w .
5+
6+
BINDIR="$(git rev-parse --show-toplevel)"/bin
7+
BINARY=$BINDIR/golangci-lint
8+
GOLANGCI_LINT_VERSION=v2.2.1
59

6-
# Install golangci-lint if not already installed
7-
if ! command -v golangci-lint &> /dev/null; then
8-
echo "golangci-lint not found, installing..."
9-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
10-
fi
1110

12-
golangci-lint run "$@" -c "${PROJECT_DIR}/.golangci.yml" --timeout 10m
11+
if [ ! -f "$BINARY" ]; then
12+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GOLANGCI_LINT_VERSION"
13+
fi
1314

15+
$BINARY run

0 commit comments

Comments
 (0)