-
Notifications
You must be signed in to change notification settings - Fork 137
/
makefile
71 lines (55 loc) · 2.09 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
GOTOOLS = github.com/golangci/golangci-lint/cmd/golangci-lint
PACKAGES=$(shell go list ./...)
INCLUDE = -I=${GOPATH}/src/github.com/tendermint/tm-db -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
export GO111MODULE = on
all: lint test
### go tests
## By default this will only test memdb & goleveldb
test:
@echo "--> Running go test"
@go test $(PACKAGES) -v
test-cleveldb:
@echo "--> Running go test"
@go test $(PACKAGES) -tags cleveldb -v
test-rocksdb:
@echo "--> Running go test"
@go test $(PACKAGES) -tags rocksdb -v
test-boltdb:
@echo "--> Running go test"
@go test $(PACKAGES) -tags boltdb -v
test-badgerdb:
@echo "--> Running go test"
@go test $(PACKAGES) -tags badgerdb -v
test-all:
@echo "--> Running go test"
@go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,badgerdb -v
lint:
@echo "--> Running linter"
@golangci-lint run
@go mod verify
.PHONY: lint
format:
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w
.PHONY: format
tools:
go get -v $(GOTOOLS)
# generates certificates for TLS testing in remotedb
gen_certs: clean_certs
certstrap init --common-name "tendermint.com" --passphrase ""
certstrap request-cert --common-name "remotedb" -ip "127.0.0.1" --passphrase ""
certstrap sign "remotedb" --CA "tendermint.com" --passphrase ""
mv out/remotedb.crt remotedb/test.crt
mv out/remotedb.key remotedb/test.key
rm -rf out
clean_certs:
rm -f db/remotedb/test.crt
rm -f db/remotedb/test.key
%.pb.go: %.proto
## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702
## Note the $< here is substituted for the %.proto
## Note the $@ here is substituted for the %.pb.go
protoc $(INCLUDE) $< --gogo_out=Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,plugins=grpc:../../..
protoc_remotedb: remotedb/proto/defs.pb.go