-
Notifications
You must be signed in to change notification settings - Fork 40
/
Makefile
32 lines (26 loc) · 1023 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
PROJECTNAME = $(shell basename "$(PWD)")
TOOL_BIN_PATH := $(shell pwd)/.tools/bin
GOBASE = $(shell pwd)
BUILD_TAGS ?=
LDFLAGS ?=
export GOBIN := $(TOOL_BIN_PATH)
export PATH := $(TOOL_BIN_PATH):$(PATH)
default: weirproxy
weirproxy:
ifeq ("$(WITH_RACE)", "1")
go build -race -gcflags '$(GCFLAGS)' -ldflags '$(LDFLAGS)' -tags '${BUILD_TAGS}' -o bin/weirproxy cmd/weirproxy/main.go
else
go build -gcflags '$(GCFLAGS)' -ldflags '$(LDFLAGS)' -tags '${BUILD_TAGS}' -o bin/weirproxy cmd/weirproxy/main.go
endif
go-test:
go test -coverprofile=.coverage.out ./...
go tool cover -func=.coverage.out -o .coverage.func
tail -1 .coverage.func
go tool cover -html=.coverage.out -o .coverage.html
go-lint-check: install-tools
golangci-lint run
go-lint-fix: install-tools
golangci-lint run --fix
install-tools:
@mkdir -p $(TOOL_BIN_PATH)
@test -e $(TOOL_BIN_PATH)/golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOL_BIN_PATH) v1.30.0