-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
75 lines (54 loc) · 2.53 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
68
69
70
71
72
73
74
75
export GO111MODULE = on
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
###############################################################################
### All ###
###############################################################################
ldflags = -X github.com/JackalLabs/sequoia/config.COMMIT=$(COMMIT) \
-X github.com/JackalLabs/sequoia/config.VERSION=$(VERSION)
all: lint test-unit
install:
@go install -ldflags '$(ldflags)'
.PHONY: install
###############################################################################
### Tools & Dependencies ###
###############################################################################
tools:
@go install github.com/client9/misspell/cmd/misspell
@go install golang.org/x/tools/cmd/goimports
go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@go mod download
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@go mod verify
@go mod tidy
clean:
rm -rf $(BUILDDIR)/
.PHONY: clean
###############################################################################
### Linting ###
###############################################################################
golangci_lint_cmd=golangci-lint
format-tools:
go install mvdan.cc/[email protected]
gofumpt -l -w .
lint: format-tools
@echo "--> Running linter"
$(golangci_lint_cmd) run --timeout=10m
lint-fix:
@echo "--> Running linter"
$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0
.PHONY: lint lint-fix format-tools
format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -path "./venv" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -path "./venv" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -name '*.pb.go' -not -path "./venv" | xargs goimports -w -local github.com/desmos-labs/cosmos-go-wallet
.PHONY: format
###############################################################################
### Tests & Simulation ###
###############################################################################
test-unit:
@echo "Executing unit tests..."
@go test -mod=readonly -v -coverprofile coverage.txt ./...
.PHONY: test-unit