-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 896 Bytes
/
Copy pathMakefile
File metadata and controls
37 lines (27 loc) · 896 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
GO_VERSION :=1.21
.PHONY: install-go init-go
setup: install-go init-go
#TODO add MacOS support
install-go:
wget "https://golang.org/dl/go$(GO_VERSION).linux-amd64.tar.gz"
sudo tar -C /usr/local -xzf go$(GO_VERSION).linux-amd64.tar.gz
rm go$(GO_VERSION).linux-amd64.tar.gz
init-go:
echo 'export PATH=$$PATH:/usr/local/go/bin' >> $${HOME}/.bashrc
echo 'export PATH=$$PATH:$${HOME}/go/bin' >> $${HOME}/.bashrc
upgrade-go: # <5>
sudo rm -rf /usr/bin/go
wget "https://golang.org/dl/go$(GO_VERSION).linux-amd64.tar.gz"
sudo tar -C /usr/local -xzf go$(GO_VERSION).linux-amd64.tar.gz
rm go$(GO_VERSION).linux-amd64.tar.gz
build:
go build -o api cmd/main.go
depend:
go mod tidy
test:
go test ./... -coverprofile=coverage.out
coverage:
go tool cover -func coverage.out | grep "total:" | \
awk '{print ((int($$3) > 80) != 1)}'
report:
go tool cover -html=coverage.out -o cover.xhtml