-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 829 Bytes
/
Copy pathMakefile
File metadata and controls
45 lines (35 loc) · 829 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
38
39
40
41
42
43
44
45
.ONESHELL:
env = GOOS=linux GOARCH=amd64
APP_NAME=api-editor
IGNORED_FOLDER=.ignore
COVERAGE_FILE=${IGNORED_FOLDER}/coverage.txt
BIN_FOLDER=bin
MODULE_NAME := $(shell go list -m)
.PHONY: all
all: install lint test build
.PHONY: install
install:
go mod download
.PHONY: lint
lint:
golint ./...
.PHONY: test
test:
mkdir -p ${IGNORED_FOLDER}
go test -race -coverprofile=${COVERAGE_FILE} -covermode=atomic ./...
.PHONY: build
build:
CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o ${BIN_FOLDER}/app ${MODULE_NAME}/cmd/${APP_NAME}
.PHONY: clean
clean:
if [ -f ${COVERAGE_FILE} ]; then
rm -rf ${COVERAGE_FILE}
fi
.PHONY: fclean
fclean: clean
rm -rf ${BIN_FOLDER}
.PHONY: tools
tools:
go get -u golang.org/x/lint/golint
go get github.com/golang/mock/gomock
go install github.com/golang/mock/mockgen