-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
52 lines (38 loc) · 1.09 KB
/
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
46
47
48
49
50
51
52
#@IgnoreInspection BashAddShebang
export ROOT=$(realpath $(dir $(lastword $(MAKEFILE_LIST))))
export DEBUG=true
export APP=gokit-realworld
export LDFLAGS="-w -s"
all: build test
build:
go build -race .
build-static:
CGO_ENABLED=0 go build -race -v -o $(APP) -a -installsuffix cgo -ldflags $(LDFLAGS) .
run:
cd cmd/server && go run -race .
############################################################
# Test
############################################################
test:
go test -v -race ./...
container:
docker build -t gokit-realworld .
run-container:
docker run --rm -it gokit-realworld
.PHONY: build run build-static test container
############################################################
# Lint
############################################################
.PHONY: install-linter check-linter lint
install-linter:
cd /tmp && GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0 && cd -
check-linter:
ifeq ($(shell which golangci-lint), )
make install-linter
endif
lint: check-linter
go mod download
golangci-lint run --fast
.PHONY: fmt
fmt:
go fmt ./...