| 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 build |
| 6 |
|
| 7 |
ci: test |
| 8 |
|
| 9 |
.PHONY: all ci |
| 10 |
|
| 11 |
######################################### |
| 12 |
# Build |
| 13 |
######################################### |
| 14 |
|
| 15 |
build: |
| 16 |
$Q go build -o bin/truststore cmd/truststore/main.go |
| 17 |
|
| 18 |
.PHONY: build |
| 19 |
|
| 20 |
######################################### |
| 21 |
# Bootstrapping |
| 22 |
######################################### |
| 23 |
|
| 24 |
bootstra%: |
| 25 |
$Q curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.49.0 |
| 26 |
$Q go install golang.org/x/vuln/cmd/govulncheck@latest |
| 27 |
$Q go install gotest.tools/[email protected] |
| 28 |
|
| 29 |
.PHONY: bootstrap |
| 30 |
|
| 31 |
######################################### |
| 32 |
# Test |
| 33 |
######################################### |
| 34 |
|
| 35 |
test: |
| 36 |
$Q $(GOFLAGS) gotestsum -- -coverpkg=./... -coverprofile=coverage.out -covermode=atomic ./... |
| 37 |
|
| 38 |
race: |
| 39 |
$Q $(GOFLAGS) gotestsum -- -race ./... |
| 40 |
|
| 41 |
.PHONY: test race |
| 42 |
|
| 43 |
######################################### |
| 44 |
# Linting |
| 45 |
######################################### |
| 46 |
|
| 47 |
fmt: |
| 48 |
$Q goimports -local github.com/golangci/golangci-lint -l -w $(SRC) |
| 49 |
|
| 50 |
lint: SHELL:=/bin/bash |
| 51 |
lint: |
| 52 |
$Q LOG_LEVEL=error golangci-lint run --config <(curl -s https://raw.githubusercontent.com/smallstep/workflows/master/.golangci.yml) --timeout=30m |
| 53 |
$Q govulncheck ./... |
| 54 |
|
| 55 |
.PHONY: fmt lint |
| 56 |
|
| 57 |
######################################### |
| 58 |
# Clean |
| 59 |
######################################### |
| 60 |
|
| 61 |
clean: |
| 62 |
rm -rf bin |
| 63 |
|
| 64 |
.PHONY: all clean |