-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
67 lines (51 loc) · 1.35 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOVET=$(GOCMD) vet
GOFMT=gofmt
GOLINT=golint
BINARY_NAME=user-microservice
all: clean build lint tool test
test:
$(GOTEST) -short -mod=vendor ./...
test-integration:
export GIN_MODE=release \
&& $(GOTEST) -short -tags=integration -mod=vendor ./...
build: ensure
$(GOBUILD) -mod=vendor .
build-linux: ensure
GOOS=linux $(GOBUILD) -mod=vendor .
tool:
$(GOVET) ./...; true
$(GOFMT) -w .
coverage:
scripts/coverage.sh
clean:
go clean -i .
rm -rf docs
rm -rf vendor
rm -f $(BINARY_NAME)
lint:
$(GOGET) golang.org/x/lint/golint
$(GOLINT) -set_exit_status $($(GOCMD) list ./... | grep -v /vendor/)
generate-swagger:
$(GOGET) github.com/swaggo/swag/cmd/swag
swag init
ensure: generate-swagger
go mod vendor
docker-build: build-linux
docker build -t $(BINARY_NAME) .
run-as-lambda: build-linux
sam local start-api
continuous-integration: ensure build lint tool test-integration coverage
help:
@echo "make: compile packages and dependencies"
@echo "make tool: run specified go tool"
@echo "make lint: golint ./..."
@echo "make clean: remove object files and cached files"
@echo "make ensure: get the deployment tools"
@echo "make coverage: get the coverage of my files"
@echo "make docker-build: build a docker image and run the container"