Skip to content

Commit 3bb7e63

Browse files
committed
Bump golangci-lint to 1.45.2
1. Greatly simplify the golangci-lint config. 1.1. Remove the skip-dir list (of excluded directories), since as all the issues are now fixed). 1.2. Instead of enabling all the linters and then disabling many of them, go with the default set of enabled linters, and then add some (currently just gocritic and dupl). This will hopefully make upgrading golangci-lint easier, as it maintains a sensitive set of linters enabled by default (and enabling all linters by default means we will enable some new and unknown linters when we bump golangci-lint version). 1.3. Remove the gocritic list of enabled linters, use a default one. The motivation is similar -- it is hard to maintain/upgrade otherwise. 1.4. Remove the "check-blank: true" option from the errcheck linter, as we often use _ = fn() type of assignment to denote that we want to ignore the error. 2. Simplify golangci-lint installation from the Makefile. 3. Bump golangci-lint to 1.45.2. NOTE that if you are using golangci-lint locally, you have to remove it from the build directory (i.e. rm -f build/golangci-lint) before running "make validate"). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent 98ddeca commit 3bb7e63

File tree

2 files changed

+5
-108
lines changed

2 files changed

+5
-108
lines changed

.golangci.yml

Lines changed: 3 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
---
22
run:
3-
skip-dirs:
4-
- libimage/manifests
5-
- pkg/manifests
6-
- pkg/supplemented
73
build-tags:
84
- apparmor
95
- seccomp
@@ -13,107 +9,12 @@ run:
139
concurrency: 6
1410
deadline: 5m
1511
linters:
16-
enable-all: true
17-
disable:
18-
- asciicheck
19-
- errcheck
20-
- exhaustive
21-
- funlen
22-
- gochecknoglobals
23-
- gochecknoinits
24-
- gocognit
25-
- goconst
26-
- godot
27-
- godox
28-
- goerr113
29-
- gofumpt
30-
- golint
31-
- gomnd
32-
- gosec
33-
- lll
34-
- maligned
35-
- nestif
36-
- nlreturn
37-
- prealloc
38-
- stylecheck
39-
- testpackage
40-
- unconvert
41-
- whitespace
42-
- wsl
12+
enable:
13+
- dupl
14+
- gocritic
4315
linters-settings:
4416
errcheck:
4517
check-type-assertions: true
46-
check-blank: true
47-
gocritic:
48-
enabled-checks:
49-
# Diagnostic
50-
- appendAssign
51-
- argOrder
52-
- badCond
53-
- caseOrder
54-
- codegenComment
55-
- commentedOutCode
56-
- deprecatedComment
57-
- dupArg
58-
- dupBranchBody
59-
- dupCase
60-
- dupSubExpr
61-
- exitAfterDefer
62-
- flagDeref
63-
- flagName
64-
- nilValReturn
65-
- offBy1
66-
- sloppyReassign
67-
- weakCond
68-
- octalLiteral
69-
70-
# Performance
71-
- appendCombine
72-
- equalFold
73-
- hugeParam
74-
- indexAlloc
75-
- rangeExprCopy
76-
- rangeValCopy
77-
78-
# Style
79-
- assignOp
80-
- boolExprSimplify
81-
- captLocal
82-
- commentFormatting
83-
- commentedOutImport
84-
- defaultCaseOrder
85-
- docStub
86-
- elseif
87-
- emptyFallthrough
88-
- emptyStringTest
89-
- hexLiteral
90-
- ifElseChain
91-
- methodExprCall
92-
- regexpMust
93-
- singleCaseSwitch
94-
- sloppyLen
95-
- stringXbytes
96-
- switchTrue
97-
- typeAssertChain
98-
- typeSwitchVar
99-
- underef
100-
- unlabelStmt
101-
- unlambda
102-
- unslice
103-
- valSwap
104-
- wrapperFunc
105-
- yodaStyleExpr
106-
107-
# Opinionated
108-
- builtinShadow
109-
- importShadow
110-
- initClause
111-
- nestingReduce
112-
- paramTypeCombine
113-
- ptrToRefParam
114-
- typeUnparen
115-
- unnamedResult
116-
- unnecessaryBlock
11718
gocyclo:
11819
min-complexity: 35
11920

Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,9 @@ vendor:
6767
.PHONY: install.tools
6868
install.tools: build/golangci-lint .install.md2man
6969

70+
build/golangci-lint: VERSION=v1.45.2
7071
build/golangci-lint:
71-
export \
72-
VERSION=v1.30.0 \
73-
URL=https://raw.githubusercontent.com/golangci/golangci-lint \
74-
BINDIR=build && \
75-
curl -sfL $$URL/$$VERSION/install.sh | sh -s $$VERSION
76-
72+
curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/$(VERSION)/install.sh | sh -s -- -b ./build $(VERSION)
7773

7874
.install.md2man:
7975
$(GO) install github.com/cpuguy83/go-md2man/v2@latest

0 commit comments

Comments
 (0)