Skip to content

Commit

Permalink
Add go versions, make scripts more resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
johnweldon committed Oct 15, 2018
1 parent dc997b2 commit 5261598
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
30 changes: 16 additions & 14 deletions .travis.yml
@@ -1,17 +1,19 @@
sudo: false
language: go
env:
global:
- VET_VERSIONS="1.6 1.7 1.8 1.9 1.10 tip"
- LINT_VERSIONS="1.7 1.8 1.9 1.10 tip"
go:
- "1.4"
- "1.5"
- "1.6"
- "1.7"
- "1.8"
- "1.9"
- "1.10"
- "1.4.x"
- "1.5.x"
- "1.6.x"
- "1.7.x"
- "1.8.x"
- "1.9.x"
- "1.10.x"
- "1.11.x"
- tip

git:
depth: 1

matrix:
fast_finish: true
allow_failures:
Expand All @@ -20,10 +22,10 @@ go_import_path: gopkg.in/ldap.v2
install:
- go get gopkg.in/asn1-ber.v1
- go get code.google.com/p/go.tools/cmd/cover || go get golang.org/x/tools/cmd/cover
- go get github.com/golang/lint/golint || true
- go get github.com/golang/lint/golint || go get golang.org/x/lint/golint || true
- go build -v ./...
script:
- make test
- make fmt
- if [[ "$VET_VERSIONS" == *"$TRAVIS_GO_VERSION"* ]]; then make vet; fi
- if [[ "$LINT_VERSIONS" == *"$TRAVIS_GO_VERSION"* ]]; then make lint; fi
- make vet
- make lint
20 changes: 18 additions & 2 deletions Makefile
Expand Up @@ -36,15 +36,31 @@ fmt:

# Only run on go1.5+
vet:
go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult .
@go tool -n vet >/dev/null 2>&1; \
if [ $$? -eq 0 ]; then \
echo "go vet" ; \
go tool vet \
-atomic \
-bool \
-copylocks \
-nilfunc \
-printf \
-shadow \
-rangeloops \
-unreachable \
-unsafeptr \
-unusedresult \
. ; \
fi ;


# https://github.com/golang/lint
# go get github.com/golang/lint/golint
# Capture output and force failure when there is non-empty output
# Only run on go1.5+
lint:
@echo golint ./...
@OUTPUT=`golint ./... 2>&1`; \
@OUTPUT=`command -v golint >/dev/null 2>&1 && golint ./... 2>&1`; \
if [ "$$OUTPUT" ]; then \
echo "golint errors:"; \
echo "$$OUTPUT"; \
Expand Down

0 comments on commit 5261598

Please sign in to comment.