| 1 |
# Set V to 1 for verbose output from the Makefile |
| 2 |
Q=$(if $V,,@) |
| 3 |
SRC=$(shell find . -type f -name '*.go') |
| 4 |
|
| 5 |
all: lint test |
| 6 |
|
| 7 |
ci: test |
| 8 |
|
| 9 |
.PHONY: all ci |
| 10 |
|
| 11 |
######################################### |
| 12 |
# Bootstrapping |
| 13 |
######################################### |
| 14 |
|
| 15 |
bootstra%: |
| 16 |
$Q curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin latest |
| 17 |
$Q go install golang.org/x/vuln/cmd/govulncheck@latest |
| 18 |
$Q go install gotest.tools/gotestsum@latest |
| 19 |
|
| 20 |
.PHONY: bootstrap |
| 21 |
|
| 22 |
######################################### |
| 23 |
# Test |
| 24 |
######################################### |
| 25 |
|
| 26 |
test: |
| 27 |
go test -cover ./... |
| 28 |
|
| 29 |
# don't run race tests by default. see https://github.com/etcd-io/bbolt/issues/187 |
| 30 |
test-race: |
| 31 |
go test -cover -race ./... |
| 32 |
|
| 33 |
.PHONY: test test-race |
| 34 |
|
| 35 |
######################################### |
| 36 |
# Linting |
| 37 |
######################################### |
| 38 |
|
| 39 |
fmt: |
| 40 |
$Q goimports -l -w $(SRC) |
| 41 |
|
| 42 |
lint: golint govulncheck |
| 43 |
|
| 44 |
golint: SHELL:=/bin/bash |
| 45 |
golint: |
| 46 |
$Q LOG_LEVEL=error golangci-lint run --config <(curl -s https://raw.githubusercontent.com/smallstep/workflows/master/.golangci.yml) --timeout=30m |
| 47 |
|
| 48 |
govulncheck: |
| 49 |
$Q govulncheck ./... |
| 50 |
|
| 51 |
.PHONY: fmt lint golint govulncheck |