mirror of
https://github.com/containers/podman
synced 2024-10-19 08:44:11 +00:00
Update lint to use golangci-lint
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
parent
e28d30c93b
commit
42830ab711
35
.golangci.yml
Normal file
35
.golangci.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
run:
|
||||
concurrency: 6
|
||||
deadline: 5m
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- depguard
|
||||
- gofmt
|
||||
- typecheck
|
||||
# - deadcode
|
||||
# - dupl
|
||||
# - errcheck
|
||||
# - gochecknoglobals
|
||||
# - gochecknoinits
|
||||
# - goconst
|
||||
# - gocritic
|
||||
# - gocyclo
|
||||
# - goimports
|
||||
# - golint
|
||||
# - gosec
|
||||
# - govet
|
||||
# - ineffassign
|
||||
# - interfacer
|
||||
# - lll
|
||||
# - maligned
|
||||
# - misspell
|
||||
# - nakedret
|
||||
# - prealloc
|
||||
# - scopelint
|
||||
# - staticcheck
|
||||
# - structcheck
|
||||
# - unconvert
|
||||
# - unparam
|
||||
# - varcheck
|
48
.tool/lint
48
.tool/lint
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# Create the linter path for use later
|
||||
LINTER=${GOPATH}/bin/gometalinter
|
||||
|
||||
# Make sure gometalinter is installed
|
||||
if [ ! -f ${LINTER} ]; then
|
||||
echo >&2 "gometalinter must be installed. Please run 'make install.tools' and try again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PKGS=$(find . -type d -not -path . -a -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*' -a -not -iname 'hack' -a -not -iwholename '*.artifacts*' -a -not -iwholename '*contrib*' -a -not -iwholename '*test*' -a -not -iwholename '*logo*' -a -not -iwholename '*conmon*' -a -not -iwholename '*completions*' -a -not -iwholename '*docs*' -a -not -iwholename '*pause*' -a -not -iwholename './_output*' -a -not -iwholename '*ioprojectatomicpodman.go')
|
||||
|
||||
echo $PKGS
|
||||
|
||||
# Execute the linter
|
||||
${LINTER} \
|
||||
--concurrency=4\
|
||||
--enable-gc\
|
||||
--vendored-linters\
|
||||
--deadline=600s --disable-all\
|
||||
--enable=deadcode\
|
||||
--enable=errcheck\
|
||||
--enable=goconst\
|
||||
--enable=gofmt\
|
||||
--enable=golint\
|
||||
--enable=ineffassign\
|
||||
--enable=megacheck\
|
||||
--enable=misspell\
|
||||
--enable=structcheck\
|
||||
--enable=varcheck\
|
||||
--enable=vet\
|
||||
--enable=vetshadow\
|
||||
--exclude='error return value not checked.*\(errcheck\)$'\
|
||||
--exclude='declaration of.*err.*shadows declaration.*\(vetshadow\)$'\
|
||||
--exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$'\
|
||||
--exclude='duplicate of.*_test.go.*\(dupl\)$'\
|
||||
--exclude='cmd\/client\/.*\.go.*\(dupl\)$'\
|
||||
--exclude='libpod\/.*_easyjson.go:.*'\
|
||||
--exclude='.* other occurrence\(s\) of "(container|host|tmpfs|unknown)" found in: .*\(goconst\)$'\
|
||||
--exclude='vendor\/.*'\
|
||||
--exclude='podman\/.*'\
|
||||
--exclude='server\/seccomp\/.*\.go.*$'\
|
||||
${PKGS[@]}
|
16
Makefile
16
Makefile
|
@ -98,8 +98,7 @@ endif
|
|||
touch $@
|
||||
|
||||
lint: .gopathok varlink_generate ## Execute the source code linter
|
||||
@echo "checking lint"
|
||||
@./.tool/lint
|
||||
golangci-lint run --build-tags="$(BUILDTAGS)"
|
||||
|
||||
gofmt: ## Verify the source code gofmt
|
||||
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
|
||||
|
@ -280,7 +279,7 @@ uninstall:
|
|||
|
||||
.PHONY: install.tools
|
||||
|
||||
install.tools: .install.gitvalidation .install.gometalinter .install.md2man .install.ginkgo ## Install needed tools
|
||||
install.tools: .install.gitvalidation .install.golangci-lint .install.md2man .install.ginkgo ## Install needed tools
|
||||
|
||||
.install.vndr: .gopathok
|
||||
$(GO) get -u github.com/LK4D4/vndr
|
||||
|
@ -295,13 +294,10 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man .ins
|
|||
$(GO) get -u github.com/vbatts/git-validation; \
|
||||
fi
|
||||
|
||||
.install.gometalinter: .gopathok
|
||||
if [ ! -x "$(GOBIN)/gometalinter" ]; then \
|
||||
$(GO) get -u github.com/alecthomas/gometalinter; \
|
||||
cd $(FIRST_GOPATH)/src/github.com/alecthomas/gometalinter; \
|
||||
git checkout e8d801238da6f0dfd14078d68f9b53fa50a7eeb5; \
|
||||
$(GO) install github.com/alecthomas/gometalinter; \
|
||||
$(GOBIN)/gometalinter --install; \
|
||||
.install.golangci-lint: .gopathok
|
||||
if [ ! -x "$(GOBIN)/golangci-lint" ]; then \
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |\
|
||||
sh -s -- -b $(GOBIN) v1.15.0 ;\
|
||||
fi
|
||||
|
||||
.install.md2man: .gopathok
|
||||
|
|
Loading…
Reference in a new issue