Skip to content

Commit e262b45

Browse files
committed
chore: update linter
1 parent 27453e4 commit e262b45

File tree

3 files changed

+77
-73
lines changed

3 files changed

+77
-73
lines changed

.github/workflows/go-cross.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: Go Matrix
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
310

411
jobs:
512

.github/workflows/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- main
77
pull_request:
8+
branches:
9+
- main
810

911
jobs:
1012

@@ -13,7 +15,7 @@ jobs:
1315
runs-on: ubuntu-latest
1416
env:
1517
GO_VERSION: stable
16-
GOLANGCI_LINT_VERSION: v1.62.2
18+
GOLANGCI_LINT_VERSION: v2.0.1
1719
CGO_ENABLED: 0
1820

1921
steps:
@@ -30,7 +32,7 @@ jobs:
3032
3133
# https://golangci-lint.run/usage/install#other-ci
3234
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
33-
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
35+
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
3436

3537
- name: Make
3638
run: make

.golangci.yml

Lines changed: 65 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,78 @@
1+
version: "2"
2+
3+
formatters:
4+
enable:
5+
- gci
6+
- gofumpt
7+
settings:
8+
gofumpt:
9+
extra-rules: true
10+
111
linters:
2-
enable-all: true
12+
default: all
313
disable:
4-
- exportloopref # deprecated
5-
- sqlclosecheck # not relevant (SQL)
6-
- rowserrcheck # not relevant (SQL)
714
- cyclop # duplicate of gocyclo
8-
- lll
915
- dupl
10-
- nlreturn
16+
- errchkjson
1117
- exhaustive
1218
- exhaustruct
13-
- testpackage
14-
- tparallel
19+
- lll
20+
- nilnil
21+
- nlreturn
22+
- nonamedreturns
1523
- paralleltest
1624
- prealloc
25+
- rowserrcheck # not relevant (SQL)
26+
- sqlclosecheck # not relevant (SQL)
27+
- testpackage
28+
- tparallel
1729
- varnamelen
18-
- nilnil
19-
- errchkjson
20-
- nonamedreturns
21-
22-
linters-settings:
23-
govet:
24-
enable-all: true
25-
disable:
26-
- fieldalignment
27-
gocyclo:
28-
min-complexity: 20
29-
goconst:
30-
min-len: 5
31-
min-occurrences: 3
32-
misspell:
33-
locale: US
34-
funlen:
35-
lines: -1
36-
statements: 40
37-
godox:
38-
keywords:
39-
- FIXME
40-
gofumpt:
41-
extra-rules: true
42-
depguard:
43-
rules:
44-
main:
45-
deny:
46-
- pkg: "github.com/instana/testify"
47-
desc: not allowed
48-
- pkg: "github.com/pkg/errors"
49-
desc: Should be replaced by standard lib errors package
50-
wsl:
51-
force-case-trailing-whitespace: 1
52-
allow-trailing-comment: true
53-
gocritic:
54-
enabled-tags:
55-
- diagnostic
56-
- style
57-
- performance
58-
disabled-checks:
59-
- sloppyReassign
60-
- rangeValCopy
61-
- octalLiteral
62-
- paramTypeCombine # already handle by gofumpt.extra-rules
63-
settings:
64-
hugeParam:
65-
sizeThreshold: 100
66-
nolintlint:
67-
require-specific: true
68-
require-explanation: true
30+
settings:
31+
depguard:
32+
rules:
33+
main:
34+
deny:
35+
- pkg: github.com/instana/testify
36+
desc: not allowed
37+
- pkg: github.com/pkg/errors
38+
desc: Should be replaced by standard lib errors package
39+
funlen:
40+
lines: -1
41+
statements: 40
42+
goconst:
43+
min-len: 5
44+
min-occurrences: 3
45+
gocritic:
46+
disabled-checks:
47+
- sloppyReassign
48+
- rangeValCopy
49+
- octalLiteral
50+
- paramTypeCombine # already handle by gofumpt.extra-rules
51+
enabled-tags:
52+
- diagnostic
53+
- style
54+
- performance
55+
settings:
56+
hugeParam:
57+
sizeThreshold: 100
58+
gocyclo:
59+
min-complexity: 20
60+
godox:
61+
keywords:
62+
- FIXME
63+
govet:
64+
disable:
65+
- fieldalignment
66+
enable-all: true
67+
misspell:
68+
locale: US
69+
nolintlint:
70+
require-explanation: true
71+
require-specific: true
72+
wsl:
73+
force-case-trailing-whitespace: 1
74+
allow-trailing-comment: true
6975

7076
issues:
71-
exclude-use-default: false
7277
max-issues-per-linter: 0
7378
max-same-issues: 0
74-
75-
output:
76-
show-stats: true
77-
sort-results: true
78-
sort-order:
79-
- linter
80-
- file
81-
82-
run:
83-
timeout: 5m

0 commit comments

Comments
 (0)