go tool vet . |& grep -Ev vendor
可本地执行进行静态检查。
另外参考github上的方案:https://github.com/thockin/go-build-template/blob/master/build/test.sh
TARGETS=$(for d in "$@"; do echo ./$d/...; done)
echo -n "Checking go vet: "
ERRS=$(go vet ${TARGETS} 2>&1 || true)
if [ -n "${ERRS}" ]; then
echo "FAIL"
echo "${ERRS}"
echo
exit 1
fi
echo "PASS"
echo