-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
69 lines (56 loc) · 1.41 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
GOFMT ?= gofmt -s -w
GOFILES := $(shell find . -name "*.go" -type f)
.PHONY: default
default: ci
.PHONY: ci
ci: misspell vet
go test ./...
.PHONY: build
build: fmt
go build -o mir mirc/main.go
.PHONY: test
test: fmt misspell vet
go test ./...
.PHONY: gen-docs
gen-docs:
@-rm -rf docs/public
@cd docs && hugo --minify --baseURL "https://alimy.me/mir/" && cd -
.PHONY: run-docs
run-docs:
@cd docs && hugo serve --minify && cd -
.PHONY: vet
vet:
go vet ./...
.PHONY: fmt-check
fmt-check:
@diff=$$($(GOFMT) -d $(GOFILES)); \
if [ -n "$$diff" ]; then \
echo "Please run 'make fmt' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi;
.PHONY: lint
lint:
@hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
go get -u golang.org/x/lint/golint; \
fi
for PKG in $(PACKAGES); do golint -min_confidence 1.0 -set_exit_status $$PKG || exit 1; done;
.PHONY: misspell-check
misspell-check:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -error $(GOFILES)
.PHONY: misspell
misspell:
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell; \
fi
misspell -w $(GOFILES)
.PHONY: fmt
fmt:
$(GOFMT) $(GOFILES)
.PHONY: tools
tools:
GO111MODULE=off go get golang.org/x/lint/golint
GO111MODULE=off go get github.com/client9/misspell/cmd/misspell