File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # install from the root of the repo with:
4+ # ln -s ../../.githooks/pre-push .git/hooks/pre-push
5+
6+ make vet fmt lint
Original file line number Diff line number Diff line change 11language : go
2+ env :
3+ global :
4+ - VET_VERSIONS="1.5 1.6 tip"
5+ - LINT_VERSIONS="1.5 1.6 tip"
26go :
37 - 1.2
48 - 1.3
59 - 1.4
610 - 1.5
11+ - 1.6
712 - tip
813go_import_path : gopkg.in/ldap.v2
914install :
1015 - go get gopkg.in/asn1-ber.v1
1116 - go get gopkg.in/ldap.v2
1217 - go get code.google.com/p/go.tools/cmd/cover || go get golang.org/x/tools/cmd/cover
18+ - go get github.com/golang/lint/golint || true
1319 - go build -v ./...
1420script :
15- - go test -v -cover ./...
21+ - make test
22+ - make fmt
23+ - if [[ "$VET_VERSIONS" == *"$TRAVIS_GO_VERSION"* ]]; then make vet; fi
24+ - if [[ "$LINT_VERSIONS" == *"$TRAVIS_GO_VERSION"* ]]; then make lint; fi
Original file line number Diff line number Diff line change 1+ .PHONY : default install build test quicktest fmt vet lint
2+
3+ default : fmt vet lint build quicktest
4+
5+ install :
6+ go get -t -v ./...
7+
8+ build :
9+ go build -v ./...
10+
11+ test :
12+ go test -v -cover ./...
13+
14+ quicktest :
15+ go test ./...
16+
17+ # Capture output and force failure when there is non-empty output
18+ fmt :
19+ @echo gofmt -l .
20+ @OUTPUT=` gofmt -l . 2>&1 ` ; \
21+ if [ " $$ OUTPUT" ]; then \
22+ echo " gofmt must be run on the following files:" ; \
23+ echo " $$ OUTPUT" ; \
24+ exit 1; \
25+ fi
26+
27+ # Only run on go1.5+
28+ vet :
29+ go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult .
30+
31+ # https://github.com/golang/lint
32+ # go get github.com/golang/lint/golint
33+ # Capture output and force failure when there is non-empty output
34+ # Only run on go1.5+
35+ lint :
36+ @echo golint ./...
37+ @OUTPUT=` golint ./... 2>&1 ` ; \
38+ if [ " $$ OUTPUT" ]; then \
39+ echo " golint errors:" ; \
40+ echo " $$ OUTPUT" ; \
41+ exit 1; \
42+ fi
Original file line number Diff line number Diff line change @@ -33,9 +33,19 @@ Import the latest version with:
3333 - search
3434 - modify
3535
36+ ## Contributing:
3637
38+ Bug reports and pull requests are welcome!
3739
40+ Before submitting a pull request, please make sure tests and verification scripts pass:
41+ ```
42+ make all
43+ ```
3844
45+ To set up a pre-push hook to run the tests and verify scripts before pushing:
46+ ```
47+ ln -s ../../.githooks/pre-push .git/hooks/pre-push
48+ ```
3949
4050---
4151The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/ )
You can’t perform that action at this time.
0 commit comments