From e90b6f96f9fee85d0d57b49c4cba3d00d98db412 Mon Sep 17 00:00:00 2001 From: Charles Kenney Date: Tue, 19 May 2020 11:58:09 -0400 Subject: [PATCH] add gomod tidy check script --- .travis.yml | 3 +++ scripts/verify-gomod-tidy.sh | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 scripts/verify-gomod-tidy.sh diff --git a/.travis.yml b/.travis.yml index 58180008e..bf60f862d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,9 @@ env: go: - "1.13" +before_script: + - bash ./scripts/verify-gomod-tidy.sh + script: - touch .env - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0 diff --git a/scripts/verify-gomod-tidy.sh b/scripts/verify-gomod-tidy.sh new file mode 100644 index 000000000..3c1ddaa99 --- /dev/null +++ b/scripts/verify-gomod-tidy.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +go mod tidy + +if [[ `git status --porcelain` ]]; then + echo 'go.mod needs updating' + echo 'Please run "go mod tidy" to fix dependencies' + exit 1 +fi + +exit 0