-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
46 lines (35 loc) · 784 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
NAME = fzwinget.exe
BIN := bin/$(NAME)
# version e.g. v0.0.1
VERSION := $(shell git describe --tags --abbrev=0)
# commit hash of HEAD e.g. 3a913f
REVISION := $(shell git rev-parse --short HEAD)
export GOOS := windows
export GOARCH := amd64
LDFLAGS := -w \
-s \
-X "main.appVersion=$(VERSION)" \
-X "main.appRevision=$(REVISION)"
COVERAGE_OUT := .test/cover.out
COVERAGE_HTML := .test/cover.html
.PHONY: build
build:
go build -ldflags "$(LDFLAGS)" -o $(BIN)
.PHONY: fmt
fmt:
go fmt
.PHONY: lint
lint:
staticcheck ./...
.PHONY: test
test:
mkdir -p .test
go test -coverprofile=$(COVERAGE_OUT) ./...
.PHONY: coverage
coverage:
go tool cover -html=$(COVERAGE_OUT) -o $(COVERAGE_HTML)
.PHONY: clean
clean:
rm $(BIN)
rm $(COVERAGE_OUT)
rm $(COVERAGE_HTML)