Last active
August 28, 2019 11:06
-
-
Save nl5887/3121149c1bcd7941f9f9441e16d35ab2 to your computer and use it in GitHub Desktop.
Git pre-commit script that will validate build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DEST=$(mktemp -d) | |
SRC=$(pwd) | |
pushd . | |
cd $DEST; git clone $SRC/.git . >/dev/null 2>&1 | |
cd $SRC; git diff -P --cached | patch -p1 -d $DEST >/dev/null | |
cd $DEST go test -v -race -run=. -bench=. ./... | |
cd $DEST golangci-lint run ./... | |
cd $DEST; go build . | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment