Skip to content

Commit 1cdb233

Browse files
committed
add lint command to Makefile
1 parent 9039e5f commit 1cdb233

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,35 @@ PKG := github.com/lightninglabs/loop
22

33
GOTEST := GO111MODULE=on go test -v
44

5+
GO_BIN := ${GOPATH}/bin
6+
7+
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
58
GOLIST := go list $(PKG)/... | grep -v '/vendor/'
69

10+
LINT_BIN := $(GO_BIN)/golangci-lint
11+
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
12+
LINT_COMMIT := v1.18.0
13+
LINT = $(LINT_BIN) run -v
14+
15+
DEPGET := cd /tmp && GO111MODULE=on go get -v
716
XARGS := xargs -L 1
817

918
TEST_FLAGS = -test.timeout=20m
1019

1120
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
1221

22+
$(LINT_BIN):
23+
@$(call print, "Fetching linter")
24+
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)
25+
1326
unit:
1427
@$(call print, "Running unit tests.")
1528
$(UNIT)
29+
30+
fmt:
31+
@$(call print, "Formatting source.")
32+
gofmt -l -w -s $(GOFILES_NOVENDOR)
33+
34+
lint: $(LINT_BIN)
35+
@$(call print, "Linting source.")
36+
$(LINT)

0 commit comments

Comments
 (0)