forked from eminetto/clean-architecture-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (28 loc) · 1.08 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
.PHONY: all
all: build
FORCE: ;
SHELL := env BOOKMARK_ENV=$(BOOKMARK_ENV) $(SHELL)
BOOKMARK_ENV ?= dev
BIN_DIR = $(PWD)/bin
.PHONY: build
clean:
rm -rf bin/*
dependencies:
go mod download
build: dependencies build-api build-cmd
build-api:
go build -tags $(BOOKMARK_ENV) -o ./bin/api api/main.go
build-cmd:
go build -tags $(BOOKMARK_ENV) -o ./bin/search cmd/main.go
linux-binaries:
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -tags "$(BOOKMARK_ENV) netgo" -installsuffix netgo -o $(BIN_DIR)/api api/main.go
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -tags "$(BOOKMARK_ENV) netgo" -installsuffix netgo -o $(BIN_DIR)/search cmd/main.go
ci: dependencies test
build-mocks:
@go get github.com/golang/mock/gomock
@go install github.com/golang/mock/mockgen
@~/go/bin/mockgen -source=pkg/bookmark/interface.go -destination=pkg/bookmark/mock/bookmark.go -package=mock
test:
go test -tags testing ./...
fmt: ## gofmt and goimports all go files
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done