diff --git a/.travis.yml b/.travis.yml index 639a68b..eb3042d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: required services: - docker go: - - 1.10.x + - 1.11.x before_install: - go get golang.org/x/lint/golint - go get honnef.co/go/tools/cmd/staticcheck diff --git a/basic.mk b/basic.mk index 96192f8..78f98ce 100644 --- a/basic.mk +++ b/basic.mk @@ -1,3 +1,6 @@ +# Set the shell +SHELL := /bin/bash + # Set an output prefix, which is the local directory if not specified PREFIX?=$(shell pwd) @@ -56,12 +59,16 @@ all: clean build fmt lint test staticcheck vet install ## Runs a clean, build, f .PHONY: fmt fmt: ## Verifies all files have been `gofmt`ed. @echo "+ $@" - @gofmt -s -l . | grep -v '.pb.go:' | grep -v vendor | tee /dev/stderr + @if [[ ! -z "$(shell gofmt -s -l . | grep -v '.pb.go' | grep -v '.twirp.go' | grep -v 'bindata.go' | grep -v vendor | tee /dev/stderr)" ]]; then \ + exit 1; \ + fi .PHONY: lint lint: ## Verifies `golint` passes. @echo "+ $@" - @golint ./... | grep -v '.pb.go:' | grep -v vendor | tee /dev/stderr + @if [[ ! -z "$(shell golint ./... | grep -v '.pb.go:' | grep -v '.twirp.go:' | grep -v vendor | tee /dev/stderr)" ]]; then \ + exit 1; \ + fi .PHONY: test test: prebuild ## Runs the go tests. @@ -71,12 +78,16 @@ test: prebuild ## Runs the go tests. .PHONY: vet vet: ## Verifies `go vet` passes. @echo "+ $@" - @$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr + @if [[ ! -z "$(shell $(GO) vet $(shell $(GO) list ./... | grep -v vendor) | tee /dev/stderr)" ]]; then \ + exit 1; \ + fi .PHONY: staticcheck staticcheck: ## Verifies `staticcheck` passes. @echo "+ $@" - @staticcheck $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr + @if [[ ! -z "$(shell staticcheck $(shell $(GO) list ./... | grep -v vendor) | grep -v 'bindata.go:' | tee /dev/stderr)" ]]; then \ + exit 1; \ + fi .PHONY: cover cover: prebuild ## Runs go test with coverage. diff --git a/examples/cl-k8s/main.go b/examples/cl-k8s/main.go index 3d89c65..a02ff15 100644 --- a/examples/cl-k8s/main.go +++ b/examples/cl-k8s/main.go @@ -24,9 +24,8 @@ var ( containerID string root string - file string - dir string - shortpath string + file string + dir string ) func init() {