-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (21 loc) · 884 Bytes
/
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
ROOT=$(realpath $(dir $(lastword $(MAKEFILE_LIST))))
BIN_DIR=build
define build-go
go build -mod=vendor -o $(BIN_DIR)/$(APP)-$1 -ldflags $(LDFLAGS) ./cmd/$1/.
endef
dev:
CGO_ENABLED=1 HERO_FMS__HOST="49.12.234.243" HERO_SWITCH__HOST="49.12.234.243" HERO_FMS__PORT=35060 HERO_SWITCH__PORT=35061 go run cmd/httpserver/main.go
build:
go build -mod=vendor -o $(BIN_DIR)/hero cmd/httpserver/main.go
lint:
which golangci-lint || (go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.0)
golangci-lint run --config=$(ROOT)/.golangci.yml $(ROOT)/...
test:
go test -v ./...
format:
@which gofumpt || (go install mvdan.cc/gofumpt@latest)
@gofumpt -l -w $(ROOT)
@which gci || (go install github.com/daixiang0/gci@latest)
@gci write $(ROOT)
@which golangci-lint || (go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.0)
@golangci-lint run --fix