mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
add lint command to Makefile
This commit is contained in:
parent
9039e5f97a
commit
1cdb233a00
1 changed files with 21 additions and 0 deletions
21
Makefile
21
Makefile
|
|
@ -2,14 +2,35 @@ PKG := github.com/lightninglabs/loop
|
|||
|
||||
GOTEST := GO111MODULE=on go test -v
|
||||
|
||||
GO_BIN := ${GOPATH}/bin
|
||||
|
||||
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
|
||||
GOLIST := go list $(PKG)/... | grep -v '/vendor/'
|
||||
|
||||
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
|
||||
XARGS := xargs -L 1
|
||||
|
||||
TEST_FLAGS = -test.timeout=20m
|
||||
|
||||
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
|
||||
|
||||
$(LINT_BIN):
|
||||
@$(call print, "Fetching linter")
|
||||
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)
|
||||
|
||||
unit:
|
||||
@$(call print, "Running unit tests.")
|
||||
$(UNIT)
|
||||
|
||||
fmt:
|
||||
@$(call print, "Formatting source.")
|
||||
gofmt -l -w -s $(GOFILES_NOVENDOR)
|
||||
|
||||
lint: $(LINT_BIN)
|
||||
@$(call print, "Linting source.")
|
||||
$(LINT)
|
||||
Loading…
Add table
Add a link
Reference in a new issue