-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (33 loc) · 858 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
BIN_DIR := $(shell pwd)/bin
# Tool versions
MDBOOK_VERSION = 0.4.40
MDBOOK := $(BIN_DIR)/mdbook
# Test tools
STATICCHECK = $(BIN_DIR)/staticcheck
.PHONY: all
all: test
.PHONY: book
book: $(MDBOOK)
rm -rf docs/book
cd docs; $(MDBOOK) build
.PHONY: test
test:
if find . -name go.mod | grep -q go.mod; then \
$(MAKE) test-go; \
fi
.PHONY: test-go
test-go: test-tools
test -z "$$(gofmt -s -l . | tee /dev/stderr)"
$(STATICCHECK) ./...
go install ./...
go test -race -v ./...
go vet ./...
##@ Tools
$(MDBOOK):
mkdir -p bin
curl -fsL https://github.com/rust-lang/mdBook/releases/download/v$(MDBOOK_VERSION)/mdbook-v$(MDBOOK_VERSION)-x86_64-unknown-linux-gnu.tar.gz | tar -C bin -xzf -
.PHONY: test-tools
test-tools: $(STATICCHECK)
$(STATICCHECK):
mkdir -p $(BIN_DIR)
GOBIN=$(BIN_DIR) go install honnef.co/go/tools/cmd/staticcheck@latest