commander-cli/cmd

View on GitHub
.githooks/pre-commit

Summary

Maintainability
Test Coverage
#!/usr/bin/env bash

echo "Run gofmt..."
FMT_FILES=`gofmt -l . | grep -v "vendor/"`
if [[ $FMT_FILES != "" ]]; then
    echo "Some files aren't formatted, please run 'go fmt ./...' to format your source code before committing"
    echo "${FMT_FILES}"
    exit 1
fi

echo "Run go vet..."
vetcount=`go vet ./... 2>&1  | wc -l`
if [ $vetcount -gt 0 ]; then
    echo "Some files aren't passing vet heuristics, please run 'go vet ./...' to see the errors it flags and correct your source code before committing"
    exit 1
fi