2019-02-11 09:40:43 +01:00
|
|
|
GO111MODULE = on
|
|
|
|
|
2019-06-18 12:09:10 +03:00
|
|
|
ENABLE_METRICS ?= true
|
|
|
|
BUILD_FLAGS ?= $(shell echo "-ldflags '\
|
|
|
|
-X github.com/status-im/status-console-client/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=$(ENABLE_METRICS)'")
|
|
|
|
|
|
|
|
|
|
|
|
DOCKER_IMAGE_NAME ?= statusteam/status-client
|
|
|
|
DOCKER_CUSTOM_TAG ?= $(shell git rev-parse --short HEAD)
|
|
|
|
|
2019-04-15 18:48:32 +08:00
|
|
|
build: GOFLAGS ?= "-mod=vendor"
|
2019-01-08 21:02:11 +01:00
|
|
|
build:
|
2019-06-18 12:09:10 +03:00
|
|
|
GOFLAGS=$(GOFLAGS) go build $(BUILD_FLAGS) -o ./bin/status-term-client .
|
2019-01-08 21:02:11 +01:00
|
|
|
.PHONY: build
|
|
|
|
|
|
|
|
run: ARGS ?=
|
|
|
|
run: build
|
|
|
|
./bin/status-term-client $(ARGS) 2>/tmp/status-term-client.log
|
|
|
|
.PHONY: run
|
|
|
|
|
|
|
|
test:
|
2019-04-12 16:53:26 +02:00
|
|
|
go test ./...
|
2019-03-11 18:49:18 +01:00
|
|
|
.PHONY: test
|
2019-02-11 09:40:43 +01:00
|
|
|
|
2019-01-08 21:02:11 +01:00
|
|
|
test-race:
|
|
|
|
go test -race ./...
|
2019-03-11 18:49:18 +01:00
|
|
|
.PHONY: test-race
|
2019-01-08 21:02:11 +01:00
|
|
|
|
|
|
|
lint:
|
2019-02-11 09:40:43 +01:00
|
|
|
golangci-lint run -v
|
2019-01-08 21:02:11 +01:00
|
|
|
.PHONY: lint
|
|
|
|
|
2019-02-11 09:40:43 +01:00
|
|
|
lint-v110:
|
|
|
|
golangci-lint run -v --config .golangci-v110.yml
|
|
|
|
.PHONY: lint-v110
|
|
|
|
|
|
|
|
vendor:
|
2019-06-19 12:19:34 +03:00
|
|
|
go mod tidy
|
2019-02-11 09:40:43 +01:00
|
|
|
go mod vendor
|
|
|
|
modvendor -copy="**/*.c **/*.h" -v
|
|
|
|
.PHONY: vendor
|
|
|
|
|
2019-03-11 18:49:18 +01:00
|
|
|
install-linter:
|
2019-02-11 09:40:43 +01:00
|
|
|
# install linter
|
2019-06-14 22:25:02 +02:00
|
|
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.17.1
|
2019-03-11 18:49:18 +01:00
|
|
|
.PHONY: install-linter
|
|
|
|
|
|
|
|
install-dev:
|
2019-02-11 09:40:43 +01:00
|
|
|
# a tool to vendor non-go files
|
2019-05-29 22:44:00 +02:00
|
|
|
go get -u github.com/goware/modvendor
|
2019-04-13 23:08:57 +02:00
|
|
|
go get -u github.com/golang/mock/gomock
|
|
|
|
go install github.com/golang/mock/mockgen
|
2019-05-15 13:19:39 +03:00
|
|
|
go get -u github.com/jteeuwen/go-bindata/go-bindata@v3.0.7
|
2019-05-29 22:44:00 +02:00
|
|
|
go mod tidy || echo 'ignore mod tidy'
|
2019-01-08 21:02:11 +01:00
|
|
|
.PHONY: install-dev
|
2019-04-13 23:08:57 +02:00
|
|
|
|
|
|
|
mock:
|
|
|
|
mockgen \
|
|
|
|
-destination ./protocol/v1/mock/protocol_mock.go \
|
|
|
|
-package protocol_mock \
|
|
|
|
github.com/status-im/status-console-client/protocol/v1 Protocol
|
|
|
|
.PHONY: mock
|
2019-05-08 10:23:51 +03:00
|
|
|
|
|
|
|
gen-migrations:
|
2019-05-14 19:34:36 +03:00
|
|
|
pushd protocol/client/migrations/ && rm -f bindata.go && go-bindata -pkg migrations ./ && popd
|
2019-05-08 10:23:51 +03:00
|
|
|
.PHONY: gen-migrations
|
2019-06-18 12:09:10 +03:00
|
|
|
|
|
|
|
image:
|
|
|
|
docker build . -t $(DOCKER_IMAGE_NAME):latest -t $(DOCKER_IMAGE_NAME):$(DOCKER_CUSTOM_TAG)
|
|
|
|
.PHONY: image
|