mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
makefile+travis: add mod check and tidy and check modules in travis
This commit is contained in:
parent
f7593dfc15
commit
d5d64fb97a
2 changed files with 17 additions and 1 deletions
16
Makefile
16
Makefile
|
|
@ -7,6 +7,7 @@ GOTEST := GO111MODULE=on go test -v
|
|||
GO_BIN := ${GOPATH}/bin
|
||||
GOBUILD := GO111MODULE=on go build -v
|
||||
GOINSTALL := GO111MODULE=on go install -v
|
||||
GOMOD := GO111MODULE=on go mod
|
||||
|
||||
COMMIT := $(shell git describe --abbrev=40 --dirty)
|
||||
LDFLAGS := -ldflags "-X $(PKG)/build.Commit=$(COMMIT)"
|
||||
|
|
@ -26,6 +27,12 @@ TEST_FLAGS = -test.timeout=20m
|
|||
|
||||
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
|
||||
|
||||
GREEN := "\\033[0;32m"
|
||||
NC := "\\033[0m"
|
||||
define print
|
||||
echo $(GREEN)$1$(NC)
|
||||
endef
|
||||
|
||||
$(LINT_BIN):
|
||||
@$(call print, "Fetching linter")
|
||||
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)
|
||||
|
|
@ -42,6 +49,15 @@ lint: $(LINT_BIN)
|
|||
@$(call print, "Linting source.")
|
||||
$(LINT)
|
||||
|
||||
mod-tidy:
|
||||
@$(call print, "Tidying modules.")
|
||||
$(GOMOD) tidy
|
||||
|
||||
mod-check:
|
||||
@$(call print, "Checking modules.")
|
||||
$(GOMOD) tidy
|
||||
if test -n "$$(git status | grep -e "go.mod\|go.sum")"; then echo "Running go mod tidy changes go.mod/go.sum"; git status; git diff; exit 1; fi
|
||||
|
||||
# ============
|
||||
# INSTALLATION
|
||||
# ============
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue