|
|
@@ -10,6 +10,10 @@
|
|
|
# PKG=snap ./test
|
|
|
set -e
|
|
|
|
|
|
+# TODO: 'client' pkg fails with gosimple from generated files
|
|
|
+# TODO: 'rafttest' is failing with unused
|
|
|
+GOSIMPLE_UNUSED_PATHS=$(go list ./... | sed -e 's/github.com\/coreos\/etcd\///g' | grep -vE 'cmd|vendor|rafttest|github.com/coreos/etcd$|client$')
|
|
|
+
|
|
|
# Invoke ./cover for HTML output
|
|
|
COVER=${COVER:-"-cover"}
|
|
|
|
|
|
@@ -96,15 +100,48 @@ function fmt_tests {
|
|
|
done
|
|
|
|
|
|
echo "Checking goword..."
|
|
|
- # get all go files to process
|
|
|
- gofiles=`find $FMT -iname '*.go' 2>/dev/null`
|
|
|
- # ignore tests and protobuf files
|
|
|
- gofiles=`echo ${gofiles} | sort | uniq | sed "s/ /\n/g" | egrep -v "(\\_test.go|\\.pb\\.go)"`
|
|
|
- # only check for broken exported godocs
|
|
|
- gowordRes=`goword -use-spell=false ${gofiles} | grep godoc-export | sort`
|
|
|
- if [ ! -z "$gowordRes" ]; then
|
|
|
- echo -e "goword checking failed:\n${gowordRes}"
|
|
|
- exit 255
|
|
|
+ if which goword >/dev/null; then
|
|
|
+ echo "goword is installed..."
|
|
|
+ # get all go files to process
|
|
|
+ gofiles=`find $FMT -iname '*.go' 2>/dev/null`
|
|
|
+ # ignore tests and protobuf files
|
|
|
+ gofiles=`echo ${gofiles} | sort | uniq | sed "s/ /\n/g" | egrep -v "(\\_test.go|\\.pb\\.go)"`
|
|
|
+ # only check for broken exported godocs
|
|
|
+ gowordRes=`goword -use-spell=false ${gofiles} | grep godoc-export | sort`
|
|
|
+ if [ ! -z "$gowordRes" ]; then
|
|
|
+ echo -e "goword checking failed:\n${gowordRes}"
|
|
|
+ exit 255
|
|
|
+ fi
|
|
|
+ else
|
|
|
+ echo "gowrod does not exist... skipping..."
|
|
|
+ fi
|
|
|
+
|
|
|
+ echo "Checking gosimple"
|
|
|
+ if which gosimple >/dev/null; then
|
|
|
+ echo "gosimple is installed..."
|
|
|
+ for path in $GOSIMPLE_UNUSED_PATHS; do
|
|
|
+ simplResult=$(gosimple $REPO_PATH/${path})
|
|
|
+ if [ -n "${simplResult}" ]; then
|
|
|
+ echo -e "gosimple checking ${path} failed:\n${simplResult}"
|
|
|
+ exit 255
|
|
|
+ fi
|
|
|
+ done
|
|
|
+ else
|
|
|
+ echo "gosimple does not exist... skipping..."
|
|
|
+ fi
|
|
|
+
|
|
|
+ echo "Checking unused"
|
|
|
+ if which unused >/dev/null; then
|
|
|
+ echo "unused is installed..."
|
|
|
+ for path in $GOSIMPLE_UNUSED_PATHS; do
|
|
|
+ unusedResult=$(unused $REPO_PATH/${path})
|
|
|
+ if [ -n "${unusedResult}" ]; then
|
|
|
+ echo -e "unused checking ${path} failed:\n${unusedResult}"
|
|
|
+ exit 255
|
|
|
+ fi
|
|
|
+ done
|
|
|
+ else
|
|
|
+ echo "unused does not exist... skipping..."
|
|
|
fi
|
|
|
|
|
|
echo "Checking for license header..."
|