-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
41 lines (31 loc) · 998 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
29
30
31
32
33
34
35
36
37
38
39
40
41
VERSION=$(shell git describe --tags --abbrev=0)
COMMIT=$(shell git rev-parse --short HEAD)
ifeq ($(VERSION),)
VERSION="0.0.0"
endif
gocyclo:
go run github.com/fzipp/gocyclo/cmd/gocyclo@latest -top 10 -ignore "_test|contract_" ./
gocognit:
go run github.com/uudashr/gocognit/cmd/gocognit@latest -top 10 -ignore "_test|contract_" ./
# sort struct fields to reduce memory usage
align:
go run github.com/dkorunic/betteralign/cmd/betteralign@latest -apply ./...
generate:
go generate ./...
lint:
go mod tidy
go run github.com/golangci/golangci-lint/cmd/[email protected] run
test:
go test -cover -race -v ./...
.PHONY: build
build: generate
mkdir -p ./build
go build \
-ldflags "-X github.com/rss3-network/node/internal/constant.Version=$(VERSION) -X github.com/rss3-network/node/internal/constant.Commit=$(COMMIT)" \
-o ./build/node ./cmd
image: generate
docker build \
--tag rss3-network/node:$(VERSION) \
.
run: generate
ENVIRONMENT=development go run ./cmd