From 1a6bfab4e9d391743e304a0b7fb3145ae560060a Mon Sep 17 00:00:00 2001 From: Jean de Klerk Date: Fri, 24 May 2019 11:07:38 -0400 Subject: [PATCH] travis: ensure dependencies are encoded in go.mod Currently a user can add new deps in *.go files that do not exist in the go.mod/go.sum. This commit adds a small check in CI to ensure that no new deps were added that aren't in the go.mod/go.sum. This commit includes a run of `go mod tidy`. --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index bb83057..8f0f200 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,12 @@ matrix: script: - go install ./... + + # Ensure no dependencies were added without encoding them in go.mod/go.sum. + - go mod tidy + - git diff go.mod | tee /dev/stderr | (! read) + - git diff go.sum | tee /dev/stderr | (! read) + - diff -u <(echo -n) <(gofmt -d .) - go test -v ./...