-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (43 loc) · 983 Bytes
/
Makefile
File metadata and controls
57 lines (43 loc) · 983 Bytes
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
GO ?= go
.PHONY: pre-pr
pre-pr: clean mock fmt-check lint vet test
.PHONY: fmt
fmt:
@gofmt -w $(GO_FILES)
.PHONY: fmt-check
fmt-check:
@unformatted=$$(gofmt -l $(GO_FILES)); \
if [ -n "$$unformatted" ]; then \
echo "unformatted files:"; \
echo "$$unformatted"; \
exit 1; \
fi
.PHONY: vet
vet:
@$(GO) vet ./...
.PHONY: lint
lint: vendor
@golangci-lint run ./...
.PHONY: mock
mock:
@mockery
.PHONY: mock-clean
mock-clean:
@find . \( -name '*_mock_test.go' -o -name '*_mock.go' \) -not -path './vendor/*' -delete
GO_FILES := $(shell find . -name '*.go' -not -path './vendor/*')
GOCACHE ?= $(CURDIR)/.go-cache
vendor: go.mod go.sum
@$(GO) mod vendor
bin/litdoc: vendor $(GO_FILES)
@GOCACHE=$(GOCACHE) $(GO) build -mod=vendor -o bin/litdoc .
.PHONY: build
build: bin/litdoc
.PHONY: test
test: vendor
@GOCACHE=$(GOCACHE) $(GO) test -mod=vendor ./... --count=1
.PHONY: vendor-clean
vendor-clean:
@rm -rf vendor/
.PHONY: clean
clean: mock-clean
@rm -rf bin/