2019-03-07 09:19:27 +00:00
|
|
|
PKG := github.com/lightninglabs/loop
|
|
|
|
|
|
|
|
GOTEST := GO111MODULE=on go test -v
|
|
|
|
|
2019-10-07 15:29:07 +00:00
|
|
|
GO_BIN := ${GOPATH}/bin
|
|
|
|
|
|
|
|
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
2019-03-07 09:19:27 +00:00
|
|
|
GOLIST := go list $(PKG)/... | grep -v '/vendor/'
|
|
|
|
|
2019-10-07 15:29:07 +00:00
|
|
|
LINT_BIN := $(GO_BIN)/golangci-lint
|
|
|
|
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
|
|
LINT_COMMIT := v1.18.0
|
|
|
|
LINT = $(LINT_BIN) run -v
|
|
|
|
|
|
|
|
DEPGET := cd /tmp && GO111MODULE=on go get -v
|
2019-03-07 09:19:27 +00:00
|
|
|
XARGS := xargs -L 1
|
|
|
|
|
|
|
|
TEST_FLAGS = -test.timeout=20m
|
|
|
|
|
|
|
|
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
|
|
|
|
|
2019-10-07 15:29:07 +00:00
|
|
|
$(LINT_BIN):
|
|
|
|
@$(call print, "Fetching linter")
|
|
|
|
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)
|
|
|
|
|
2019-03-07 09:19:27 +00:00
|
|
|
unit:
|
|
|
|
@$(call print, "Running unit tests.")
|
|
|
|
$(UNIT)
|
2019-10-07 15:29:07 +00:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
@$(call print, "Formatting source.")
|
|
|
|
gofmt -l -w -s $(GOFILES_NOVENDOR)
|
|
|
|
|
|
|
|
lint: $(LINT_BIN)
|
|
|
|
@$(call print, "Linting source.")
|
|
|
|
$(LINT)
|