-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 812 Bytes
/
Makefile
File metadata and controls
37 lines (29 loc) · 812 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
.PHONY: all clean test bench build
# 编译传入参数: 应用名称,默认iot-data
NAME:=flog
# 编译传入参数: Golang版本
GO_VERSION:=$(shell go version)
# 编译传入参数: 编译时间
BUILD_TIME:=$(shell date +'%FT%T%z')
# tag的版本号,自动根据tag填入
TAG_VERSION:=$(shell git describe --tags --always)
# 编译传入参数: 编译使用分支
BRANCH:=$(shell git rev-parse --abbrev-ref HEAD)
PARAMETER="\
-X 'main.name=$(NAME)' \
-X 'main.goVersion=$(GO_VERSION)' \
-X 'main.buildTime=$(BUILD_TIME)' \
-X 'main.tagVersion=$(TAG_VERSION)' \
-X 'main.branch=$(BRANCH)'
GOPROXY:="https://goproxy.cn,direct"
.DEFAULT: all
all: test
clean:
test: prepare
@echo test...
@go test -v -count=1 ./...
bench: prepare
@echo benchmark...
@go test -run=^$$ -bench=.
prepare:
@go mod tidy