2017-11-01 20:24:45 +00:00
#!/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
2018-04-24 17:40:48 +00:00
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')
2017-11-03 19:37:22 +00:00
echo $PKGS
2017-11-01 20:24:45 +00:00
# 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\)$'\
2018-11-04 17:50:53 +00:00
--exclude='libpod\/.*_easyjson.go:.*'\
2018-11-10 09:44:03 +00:00
--exclude='.* other occurrence\(s\) of "(container|host|tmpfs|unknown)" found in: .*\(goconst\)$'\
2017-11-01 20:24:45 +00:00
--exclude='vendor\/.*'\
2017-12-15 21:58:36 +00:00
--exclude='podman\/.*'\
2017-11-01 20:24:45 +00:00
--exclude='server\/seccomp\/.*\.go.*$'\
${PKGS[@]}