-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
54 lines (41 loc) · 1.06 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
.PHONY: all build clean download get-build-deps vet lint test cover
TOOL_NAME := ini-file
# Load relative to the common.mk file
include $(dir $(lastword $(MAKEFILE_LIST)))/vars.mk
include ./vars.mk
all:
@$(MAKE) get-build-deps
@$(MAKE) download
@$(MAKE) vet
@$(MAKE) lint
@$(MAKE) cover
@$(MAKE) build
build/%:
@echo "Building GOARCH=$(*F)"
@GOARCH=$(*F) go build -ldflags=$(LDFLAGS) -o $(TOOL_PATH)
@echo "*** Binary created under $(TOOL_PATH) ***"
build: build/amd64
clean:
@rm -rf $(BUILD_DIR)
download:
$(GO_MOD) download
get-build-deps:
@echo "+ Downloading build dependencies"
@go install golang.org/x/tools/cmd/goimports@latest
@go install honnef.co/go/tools/cmd/staticcheck@latest
vet:
@echo "+ Vet"
@go vet ./...
lint:
@echo "+ Linting package"
@staticcheck ./...
$(call fmtcheck, .)
test:
@echo "+ Testing package"
$(GO_TEST) .
cover: test
@echo "+ Tests Coverage"
@mkdir -p $(BUILD_DIR)
@touch $(BUILD_DIR)/cover.out
@go test -coverprofile=$(BUILD_DIR)/cover.out
@go tool cover -html=$(BUILD_DIR)/cover.out -o=$(BUILD_DIR)/coverage.html