-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.1 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
BINARY_NAME = tldr
.PHONY: build
build:
go build -v -o $(BINARY_NAME) ./cmd/$(BINARY_NAME)
# (build but with a smaller binary)
.PHONY: dist
dist:
go build -gcflags=all=-l -v -ldflags="-w -s" -o $(BINARY_NAME) ./cmd/$(BINARY_NAME)
.PHONY: run
run: build
./$(BINARY_NAME)
.PHONY: test
test:
$(TEST_COMMAND) -cover -parallel 5 -failfast -count=1 ./...
# human readable test output
.PHONY: love
love:
ifeq ($(filter watch,$(MAKECMDGOALS)),watch)
gotestsum --watch ./...
else
gotestsum ./...
endif
.PHONY: tidy
tidy:
go mod tidy
install: build
sudo cp ./tldr /usr/bin/
.PHONY: lint
lint:
revive -formatter friendly -config revive.toml ./...
.PHONY: staticcheck
staticcheck:
staticcheck ./...
.PHONY: gosec
gosec:
gosec -tests ./...
.PHONY: inspect
inspect: lint gosec staticcheck
.PHONY: install-inspect-tools
install-inspect-tools:
go install github.com/mgechev/revive@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/securego/gosec/v2/cmd/gosec@latest
.PHONY: install-dev-tools
install-dev-tools: install-inspect-tools
go install gotest.tools/gotestsum@latest