github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/tm-db/makefile (about)

     1  GOTOOLS = github.com/golangci/golangci-lint/cmd/golangci-lint
     2  PACKAGES=$(shell go list ./...)
     3  INCLUDE = -I=${GOPATH}/src/github.com/tendermint/tm-db -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
     4  
     5  export GO111MODULE = on
     6  
     7  all: lint test
     8  
     9  ### go tests
    10  ## By default this will only test memdb & goleveldb
    11  test:
    12  	@echo "--> Running go test"
    13  	@go test -p 1 $(PACKAGES) -v
    14  
    15  test-cleveldb:
    16  	@echo "--> Running go test"
    17  	@go test -p 1 $(PACKAGES) -tags cleveldb -v
    18  
    19  test-rocksdb:
    20  	@echo "--> Running go test"
    21  	@go test -p 1 $(PACKAGES) -tags rocksdb -v
    22  
    23  test-boltdb:
    24  	@echo "--> Running go test"
    25  	@go test -p 1 $(PACKAGES) -tags boltdb -v
    26  
    27  test-all:
    28  	@echo "--> Running go test"
    29  	@go test -p 1 $(PACKAGES) -tags cleveldb,boltdb,rocksdb -v
    30  
    31  lint:
    32  	@echo "--> Running linter"
    33  	@golangci-lint run
    34  	@go mod verify
    35  .PHONY: lint
    36  
    37  format:
    38  	find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
    39  	find . -name '*.go' -type f -not -path "*.git*"  -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w
    40  .PHONY: format
    41  
    42  tools:
    43  	go get -v $(GOTOOLS)
    44  
    45  # generates certificates for TLS testing in remotedb
    46  gen_certs: clean_certs
    47  	certstrap init --common-name "tendermint.com" --passphrase ""
    48  	certstrap request-cert --common-name "remotedb" -ip "127.0.0.1" --passphrase ""
    49  	certstrap sign "remotedb" --CA "tendermint.com" --passphrase ""
    50  	mv out/remotedb.crt db/remotedb/test.crt
    51  	mv out/remotedb.key db/remotedb/test.key
    52  	rm -rf out
    53  
    54  clean_certs:
    55  	rm -f db/remotedb/test.crt
    56  	rm -f db/remotedb/test.key
    57  
    58  %.pb.go: %.proto
    59  	## If you get the following error,
    60  	## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
    61  	## See https://stackoverflow.com/a/25518702
    62  	## Note the $< here is substituted for the %.proto
    63  	## Note the $@ here is substituted for the %.pb.go
    64  	protoc $(INCLUDE) $< --gogo_out=Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,plugins=grpc:../../..
    65  
    66  
    67  protoc_remotedb: remotedb/proto/defs.pb.go