From 049969911dbf8556eafdde07cfabbcf05fb5ec9b Mon Sep 17 00:00:00 2001 From: Lars Karlitski Date: Fri, 14 Feb 2020 13:22:38 +0100 Subject: [PATCH] tools: add prepare-source.sh A script that runs various go tools (mod tidy, mod vendor, and fmt for now). The idea is that it prepares the source to be ready for master. As such, running it on master shouldn't modify any files. Make sure of that by adding a test. --- .travis.yml | 10 ++++++++++ tools/prepare-source.sh | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100755 tools/prepare-source.sh diff --git a/.travis.yml b/.travis.yml index 58a8450b8..3ec8a2b65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,16 @@ addons: - gnupg2 matrix: include: + - name: source-test + script: + - | + set -e + ./tools/prepare-source.sh + if [ ! $(git diff --quiet --exit-code) ]; then + echo + echo "Please include these changes in your branch: " + git diff + fi - name: unit-tests arch: amd64 language: go diff --git a/tools/prepare-source.sh b/tools/prepare-source.sh new file mode 100755 index 000000000..f77218b57 --- /dev/null +++ b/tools/prepare-source.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eux + +go fmt ./... +go mod tidy +go mod vendor