|
@@ -1,8 +1,36 @@
|
|
|
#!/bin/sh
|
|
|
|
|
|
-# Install the lint-tool, and the shadow-tool
|
|
|
-go get -u golang.org/x/lint/golint
|
|
|
-go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
|
|
|
+
|
|
|
+# I don't even ..
|
|
|
+go env -w GOFLAGS="-buildvcs=false"
|
|
|
+
|
|
|
+
|
|
|
+# Install the tools we use to test our code-quality.
|
|
|
+#
|
|
|
+# Here we setup the tools to install only if the "CI" environmental variable
|
|
|
+# is not empty. This is because locally I have them installed.
|
|
|
+#
|
|
|
+# NOTE: Github Actions always set CI=true
|
|
|
+#
|
|
|
+if [ ! -z "${CI}" ] ; then
|
|
|
+ go install golang.org/x/lint/golint@latest
|
|
|
+ go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
|
|
|
+ go install honnef.co/go/tools/cmd/staticcheck@latest
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
+# Run the static-check tool - we ignore errors in goserver/static.go
|
|
|
+t=$(mktemp)
|
|
|
+staticcheck -checks all ./... | grep -v "is deprecated"> $t
|
|
|
+if [ -s $t ]; then
|
|
|
+ echo "Found errors via 'staticcheck'"
|
|
|
+ cat $t
|
|
|
+ rm $t
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+rm $t
|
|
|
+
|
|
|
+
|
|
|
|
|
|
# At this point failures cause aborts
|
|
|
set -e
|