...

Text file src/github.com/PuerkitoBio/goquery/misc/git/pre-commit

Documentation: github.com/PuerkitoBio/goquery/misc/git

     1#!/bin/sh
     2
     3echo ">>> golint"
     4for dir in $(go list ./... | grep -v /vendor/)
     5do
     6    golint "${dir}"
     7done
     8echo "<<< golint"
     9echo
    10
    11echo ">>> go vet"
    12go vet $(go list ./... | grep -v /vendor/)
    13echo "<<< go vet"
    14echo
    15
    16echo ">>> gosimple"
    17gosimple $(go list ./... | grep -v /vendor/)
    18echo "<<< gosimple"
    19echo
    20
    21# Check for gofmt problems and report if any.
    22gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '.go$' | grep -v /vendor/)
    23[ -z "$gofiles" ] && echo "EXIT $vetres" && exit $vetres
    24
    25if [ -n "$gofiles" ]; then
    26    unformatted=$(gofmt -l $gofiles)
    27
    28    if [ -n "$unformatted" ]; then
    29        # Some files are not gofmt'd.
    30        echo >&2 "Go files must be formatted with gofmt. Please run:"
    31        for fn in $unformatted; do
    32            echo >&2 "  gofmt -w $PWD/$fn"
    33        done
    34    fi
    35fi
    36echo
    37

View as plain text