-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
51 lines (39 loc) · 1.46 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
VERSION=$(shell git describe --tags)
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_COMMIT_DATE=$(shell git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
REPO=github.com/bnb-chain/greenfield-relayer
IMAGE_NAME=ghcr.io/bnb-chain/greenfield-relayer
ldflags = -X $(REPO)/version.AppVersion=$(VERSION) \
-X $(REPO)/version.GitCommit=$(GIT_COMMIT) \
-X $(REPO)/version.GitCommitDate=$(GIT_COMMIT_DATE)
build:
ifeq ($(OS),Windows_NT)
go build -o build/greenfield-relayer.exe -ldflags="$(ldflags)" main.go
else
go build -o build/greenfield-relayer -ldflags="$(ldflags)" main.go
endif
install:
ifeq ($(OS),Windows_NT)
go install main.go
else
go install main.go
endif
build_docker:
docker build . -t ${IMAGE_NAME}
.PHONY: build install build_docker
###############################################################################
### Linting ###
###############################################################################
golangci_lint_cmd=golangci-lint
golangci_version=v1.51.2
lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m
lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0
format:
bash scripts/format.sh
.PHONY: lint lint-fix format