Skip to content

Commit

Permalink
Add a lint script to golint correctly and use it
Browse files Browse the repository at this point in the history
  • Loading branch information
kshlm committed Sep 27, 2016
1 parent 55ecabe commit daec652
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ vendor-update:
@echo

verify: check-reqs
@./scripts/lint.sh
@GO15VENDOREXPERIMENT=1 gometalinter -D gotype -E gofmt --errors --deadline=5m -j 4 $$(GO15VENDOREXPERIMENT=1 glide nv)

test:
Expand Down
16 changes: 16 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#/bin/bash

# NOTE: This script needs be run from the root of the GD2 repository

# Find all Go source files in the repository, that are not vendored or generated
# and then run golint on them

RETVAL=0

for file in $(find . -path ./vendor -prune -o -type f -name '*.go' -not -name '*.pb.go' -print); do
golint -set_exit_status $file
if [ $? -eq 1 -a $RETVAL -eq 0 ]; then
RETVAL=1
fi
done
exit $RETVAL

0 comments on commit daec652

Please sign in to comment.