Merge pull request #285 from openSUSE/golangci-lint
Update golangci-lint and add config
This commit is contained in:
commit
a0a02519cf
|
|
@ -11,3 +11,4 @@
|
|||
contrib/spec/podman.spec
|
||||
*.rpm
|
||||
*~
|
||||
build
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
---
|
||||
run:
|
||||
build-tags:
|
||||
- apparmor
|
||||
- seccomp
|
||||
- selinux
|
||||
- exclude_graphdriver_btrfs
|
||||
concurrency: 6
|
||||
deadline: 5m
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- asciicheck
|
||||
- errcheck
|
||||
- exhaustive
|
||||
- funlen
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
- gocognit
|
||||
- goconst
|
||||
- godot
|
||||
- godox
|
||||
- goerr113
|
||||
- gofumpt
|
||||
- golint
|
||||
- gomnd
|
||||
- gosec
|
||||
- lll
|
||||
- maligned
|
||||
- nestif
|
||||
- nlreturn
|
||||
- prealloc
|
||||
- stylecheck
|
||||
- testpackage
|
||||
- unconvert
|
||||
- whitespace
|
||||
- wsl
|
||||
linters-settings:
|
||||
errcheck:
|
||||
check-type-assertions: true
|
||||
check-blank: true
|
||||
gocritic:
|
||||
enabled-checks:
|
||||
# Diagnostic
|
||||
- appendAssign
|
||||
- argOrder
|
||||
- badCond
|
||||
- caseOrder
|
||||
- codegenComment
|
||||
- commentedOutCode
|
||||
- deprecatedComment
|
||||
- dupArg
|
||||
- dupBranchBody
|
||||
- dupCase
|
||||
- dupSubExpr
|
||||
- exitAfterDefer
|
||||
- flagDeref
|
||||
- flagName
|
||||
- nilValReturn
|
||||
- offBy1
|
||||
# - sloppyReassign
|
||||
- weakCond
|
||||
- octalLiteral
|
||||
|
||||
# Performance
|
||||
- appendCombine
|
||||
- equalFold
|
||||
- hugeParam
|
||||
- indexAlloc
|
||||
- rangeExprCopy
|
||||
- rangeValCopy
|
||||
|
||||
# Style
|
||||
- assignOp
|
||||
- boolExprSimplify
|
||||
- captLocal
|
||||
# - commentFormatting
|
||||
- commentedOutImport
|
||||
- defaultCaseOrder
|
||||
- docStub
|
||||
# - elseif
|
||||
- emptyFallthrough
|
||||
# - emptyStringTest
|
||||
- hexLiteral
|
||||
- ifElseChain
|
||||
- methodExprCall
|
||||
- regexpMust
|
||||
- singleCaseSwitch
|
||||
- sloppyLen
|
||||
- stringXbytes
|
||||
- switchTrue
|
||||
- typeAssertChain
|
||||
- typeSwitchVar
|
||||
- underef
|
||||
- unlabelStmt
|
||||
- unlambda
|
||||
- unslice
|
||||
- valSwap
|
||||
- wrapperFunc
|
||||
- yodaStyleExpr
|
||||
|
||||
# Opinionated
|
||||
# - builtinShadow
|
||||
# - importShadow
|
||||
- initClause
|
||||
- nestingReduce
|
||||
- paramTypeCombine
|
||||
- ptrToRefParam
|
||||
- typeUnparen
|
||||
# - unnamedResult
|
||||
- unnecessaryBlock
|
||||
|
|
@ -64,8 +64,8 @@ docs:
|
|||
$(MAKE) -C docs
|
||||
|
||||
.PHONY: validate
|
||||
validate:
|
||||
golangci-lint run
|
||||
validate: build/golangci-lint
|
||||
./build/golangci-lint run
|
||||
|
||||
vendor-in-container:
|
||||
podman run --privileged --rm --env HOME=/root -v `pwd`:/src -w /src golang make vendor
|
||||
|
|
@ -77,12 +77,14 @@ vendor:
|
|||
GO111MODULE=on $(GO) mod verify
|
||||
|
||||
.PHONY: install.tools
|
||||
install.tools: .install.golangci-lint .install.md2man
|
||||
install.tools: build/golangci-lint .install.md2man
|
||||
|
||||
.install.golangci-lint:
|
||||
if [ ! -x "$(GOBIN)/golangci-lint" ]; then \
|
||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOBIN)/ v1.18.0; \
|
||||
fi
|
||||
build/golangci-lint:
|
||||
export \
|
||||
VERSION=v1.30.0 \
|
||||
URL=https://raw.githubusercontent.com/golangci/golangci-lint \
|
||||
BINDIR=build && \
|
||||
curl -sfL $$URL/$$VERSION/install.sh | sh -s $$VERSION
|
||||
|
||||
|
||||
.install.md2man:
|
||||
|
|
|
|||
Loading…
Reference in New Issue