pre-commit 532 字节
Newer Older
1 2 3 4 5
#! /bin/bash

set -eu

golint
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
misspell --error .

# gofmt doesn't exit with an error code if the files don't match the expected
# format. So we have to run it and see if it outputs anything.
if gofmt -l -s . 2>&1 | read
then
    echo "Error: not all code had been formatted with gofmt."
    echo "Fixing the following files"
    gofmt -s -w -l .
    echo
    echo "Please add them to the commit"
    git status --short
    exit 1
fi

ineffassign .

23 24 25 26
go fmt
go tool vet --all --shadow .
gocyclo -over 12 .
go test -timeout 5s -test.v