Skip to content

Commit 0ae13bd

Browse files
Update golagci-lint
1 parent 7818e0b commit 0ae13bd

File tree

4 files changed

+170
-142
lines changed

4 files changed

+170
-142
lines changed

cgo/.golangci.yml

Lines changed: 83 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,89 @@
1-
# https://golangci-lint.run/usage/configuration/
2-
# To get the list of available linters: ./target/binutil/golangci-lint help linters
3-
1+
version: "2"
42
run:
53
issues-exit-code: 1
64
tests: true
7-
timeout: 5m
8-
95
output:
10-
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
11-
formats: colored-line-number
12-
13-
linters-settings:
14-
funlen:
15-
lines: 100
16-
statements: 50
17-
ignore-comments: true
18-
gocognit:
19-
min-complexity: 10
20-
gocyclo:
21-
min-complexity: 10
22-
gofmt:
23-
simplify: true
24-
misspell:
25-
locale: US
26-
whitespace:
27-
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
28-
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
29-
depguard:
30-
rules:
31-
main:
32-
files:
33-
- $all
34-
- "!$test"
35-
allow:
36-
- $gostd
37-
- github.com/Vonage
38-
test:
39-
files:
40-
- "$test"
41-
allow:
42-
- $gostd
43-
- github.com/stretchr
44-
gosec:
45-
excludes:
46-
# Flags for potentially-unsafe casting of ints, similar problem to globally-disabled G103
47-
- G115
48-
49-
issues:
50-
exclude-dirs-use-default: true
51-
exclude-dirs:
52-
- .github
53-
- .githook
54-
exclude-rules:
55-
- path: _test.go
56-
linters:
57-
- dupl
58-
- funlen
59-
# fix: true
60-
6+
formats:
7+
text:
8+
path: stdout
619
linters:
62-
enable-all: true
10+
default: all
6311
disable:
64-
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
65-
- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
66-
- err113 # Go linter to check the errors handling expressions [fast: false, auto-fix: false]
67-
- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
68-
- lll # Reports long lines [fast: true, auto-fix: false]
69-
- mnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
70-
- musttag # enforce field tags in (un)marshaled structs [fast: false, auto-fix: false]
71-
- nlreturn # Accept Nil, Return Non-Nil [fast: false, auto-fix: false]
72-
- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
73-
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
74-
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
75-
- tenv # deprecated
12+
- depguard
13+
- err113
14+
- exhaustruct
15+
- ireturn
16+
- lll
17+
- mnd
18+
- musttag
19+
- nlreturn
20+
- tagliatelle
21+
- testpackage
22+
- varnamelen
23+
settings:
24+
depguard:
25+
rules:
26+
main:
27+
files:
28+
- $all
29+
- '!$test'
30+
allow:
31+
- $gostd
32+
- github.com/Vonage
33+
test:
34+
files:
35+
- $test
36+
allow:
37+
- $gostd
38+
- github.com/stretchr
39+
funlen:
40+
lines: 100
41+
statements: 50
42+
ignore-comments: true
43+
gocognit:
44+
min-complexity: 10
45+
gocyclo:
46+
min-complexity: 10
47+
gosec:
48+
excludes:
49+
- G115
50+
misspell:
51+
locale: US
52+
whitespace:
53+
multi-if: false
54+
multi-func: false
55+
exclusions:
56+
generated: lax
57+
presets:
58+
- comments
59+
- common-false-positives
60+
- legacy
61+
- std-error-handling
62+
rules:
63+
- linters:
64+
- dupl
65+
- funlen
66+
path: _test.go
67+
paths:
68+
- .github
69+
- .githook
70+
- third_party$
71+
- builtin$
72+
- examples$
73+
formatters:
74+
enable:
75+
- gci
76+
- gofmt
77+
- gofumpt
78+
- goimports
79+
settings:
80+
gofmt:
81+
simplify: true
82+
exclusions:
83+
generated: lax
84+
paths:
85+
- .github
86+
- .githook
87+
- third_party$
88+
- builtin$
89+
- examples$

cgo/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ GOFMT=$(shell which gofmt)
5050
GOTEST=GOPATH=$(GOPATH) $(shell which gotest)
5151
GODOC=GOPATH=$(GOPATH) $(shell which godoc)
5252
GOLANGCILINT=$(BINUTIL)/golangci-lint
53-
GOLANGCILINTVERSION=v1.64.8
53+
GOLANGCILINTVERSION=v2.0.1
5454

5555
# Directory containing the source code
5656
SRCDIR=./src
@@ -140,7 +140,7 @@ format:
140140
# Execute multiple linter tools
141141
.PHONY: linter
142142
linter:
143-
$(GOLANGCILINT) run --exclude-use-default=false --max-issues-per-linter 0 --max-same-issues 0 $(SRCDIR)/...
143+
$(GOLANGCILINT) run --max-issues-per-linter 0 --max-same-issues 0 $(SRCDIR)/...
144144

145145
.PHONY: mod
146146
mod:

go/.golangci.yml

Lines changed: 83 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,89 @@
1-
# https://golangci-lint.run/usage/configuration/
2-
# To get the list of available linters: ./target/binutil/golangci-lint help linters
3-
1+
version: "2"
42
run:
53
issues-exit-code: 1
64
tests: true
7-
timeout: 5m
8-
95
output:
10-
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
11-
formats: colored-line-number
12-
13-
linters-settings:
14-
funlen:
15-
lines: 100
16-
statements: 50
17-
ignore-comments: true
18-
gocognit:
19-
min-complexity: 10
20-
gocyclo:
21-
min-complexity: 10
22-
gofmt:
23-
simplify: true
24-
misspell:
25-
locale: US
26-
whitespace:
27-
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
28-
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
29-
depguard:
30-
rules:
31-
main:
32-
files:
33-
- $all
34-
- "!$test"
35-
allow:
36-
- $gostd
37-
- github.com/Vonage
38-
test:
39-
files:
40-
- "$test"
41-
allow:
42-
- $gostd
43-
- github.com/stretchr
44-
gosec:
45-
excludes:
46-
# Flags for potentially-unsafe casting of ints, similar problem to globally-disabled G103
47-
- G115
48-
49-
issues:
50-
exclude-dirs-use-default: true
51-
exclude-dirs:
52-
- .github
53-
- .githook
54-
exclude-rules:
55-
- path: _test.go
56-
linters:
57-
- dupl
58-
- funlen
59-
# fix: true
60-
6+
formats:
7+
text:
8+
path: stdout
619
linters:
62-
enable-all: true
10+
default: all
6311
disable:
64-
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
65-
- exhaustruct # Checks if all structure fields are initialized [fast: false, auto-fix: false]
66-
- err113 # Go linter to check the errors handling expressions [fast: false, auto-fix: false]
67-
- ireturn # Accept Interfaces, Return Concrete Types [fast: false, auto-fix: false]
68-
- lll # Reports long lines [fast: true, auto-fix: false]
69-
- mnd # An analyzer to detect magic numbers. [fast: true, auto-fix: false]
70-
- musttag # enforce field tags in (un)marshaled structs [fast: false, auto-fix: false]
71-
- nlreturn # Accept Nil, Return Non-Nil [fast: false, auto-fix: false]
72-
- tagliatelle # Checks the struct tags. [fast: true, auto-fix: false]
73-
- testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false]
74-
- varnamelen # checks that the length of a variable's name matches its scope [fast: false, auto-fix: false]
75-
- tenv # deprecated
12+
- depguard
13+
- err113
14+
- exhaustruct
15+
- ireturn
16+
- lll
17+
- mnd
18+
- musttag
19+
- nlreturn
20+
- tagliatelle
21+
- testpackage
22+
- varnamelen
23+
settings:
24+
depguard:
25+
rules:
26+
main:
27+
files:
28+
- $all
29+
- '!$test'
30+
allow:
31+
- $gostd
32+
- github.com/Vonage
33+
test:
34+
files:
35+
- $test
36+
allow:
37+
- $gostd
38+
- github.com/stretchr
39+
funlen:
40+
lines: 100
41+
statements: 50
42+
ignore-comments: true
43+
gocognit:
44+
min-complexity: 10
45+
gocyclo:
46+
min-complexity: 10
47+
gosec:
48+
excludes:
49+
- G115
50+
misspell:
51+
locale: US
52+
whitespace:
53+
multi-if: false
54+
multi-func: false
55+
exclusions:
56+
generated: lax
57+
presets:
58+
- comments
59+
- common-false-positives
60+
- legacy
61+
- std-error-handling
62+
rules:
63+
- linters:
64+
- dupl
65+
- funlen
66+
path: _test.go
67+
paths:
68+
- .github
69+
- .githook
70+
- third_party$
71+
- builtin$
72+
- examples$
73+
formatters:
74+
enable:
75+
- gci
76+
- gofmt
77+
- gofumpt
78+
- goimports
79+
settings:
80+
gofmt:
81+
simplify: true
82+
exclusions:
83+
generated: lax
84+
paths:
85+
- .github
86+
- .githook
87+
- third_party$
88+
- builtin$
89+
- examples$

go/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ GOFMT=$(shell which gofmt)
5050
GOTEST=GOPATH=$(GOPATH) $(shell which gotest)
5151
GODOC=GOPATH=$(GOPATH) $(shell which godoc)
5252
GOLANGCILINT=$(BINUTIL)/golangci-lint
53-
GOLANGCILINTVERSION=v1.64.8
53+
GOLANGCILINTVERSION=v2.0.1
5454

5555
# Directory containing the source code
5656
SRCDIR=./src
@@ -143,7 +143,7 @@ format:
143143
# Execute multiple linter tools
144144
.PHONY: linter
145145
linter:
146-
$(GOLANGCILINT) run --exclude-use-default=false --max-issues-per-linter 0 --max-same-issues 0 $(SRCDIR)/...
146+
$(GOLANGCILINT) run --max-issues-per-linter 0 --max-same-issues 0 $(SRCDIR)/...
147147

148148
.PHONY: mod
149149
mod:

0 commit comments

Comments
 (0)