summaryrefslogtreecommitdiffstats
path: root/ci/lint.sh
diff options
context:
space:
mode:
authorDuco van Amstel <duco.vanamstel@gmail.com>2019-04-04 21:54:51 +0100
committerWim <wim@42.be>2019-04-04 22:54:51 +0200
commit7f0e4ad4487cf03288af7519434f5d54844f47e1 (patch)
tree3498fb2c1436ee15a3388d1325debe726cd6d7fd /ci/lint.sh
parent17cc14a9d2351fcd0608c2a81eb32fd9fc3ec987 (diff)
downloadmatterbridge-msglm-7f0e4ad4487cf03288af7519434f5d54844f47e1.tar.gz
matterbridge-msglm-7f0e4ad4487cf03288af7519434f5d54844f47e1.tar.bz2
matterbridge-msglm-7f0e4ad4487cf03288af7519434f5d54844f47e1.zip
Add CI fixes and improvements (#780)
* Update GolangCI-lint and lint config The `algo` parameter for the `unparam` linter has been removed and we should thus no longer specify it. Also, bumping the GolangCI-lint version to the latest available minor release. See: mvdan/unparam@e6a6d1c51b6f03ac1a9d120f1ea07bc3a3f0e0b9 * Fix and improve bintray CI script * Further CI setup improvements * Split-out CI steps into stand-alone scripts
Diffstat (limited to 'ci/lint.sh')
-rwxr-xr-xci/lint.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/ci/lint.sh b/ci/lint.sh
new file mode 100755
index 00000000..f68c2c92
--- /dev/null
+++ b/ci/lint.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -u -e -x -o pipefail
+
+if [[ -n "${GOLANGCI_VERSION-}" ]]; then
+ # Retrieve the golangci-lint linter binary.
+ curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b ${GOPATH}/bin ${GOLANGCI_VERSION}
+fi
+
+# Run the linter.
+golangci-lint run
+
+if [[ "${GO111MODULE-off}" == "on" ]]; then
+ # If Go modules are active then check that dependencies are correctly maintained.
+ go mod tidy
+ go mod vendor
+ git diff --exit-code --quiet || (echo "Please run 'go mod tidy' to clean up the 'go.mod' and 'go.sum' files."; false)
+fi