File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ sudo: required
2323
2424script :
2525 - export GO111MODULE=on
26- - make lint unit build
26+ - make lint unit build mod-check
2727
2828after_script :
2929 - echo "Uploading to termbin.com..." && find *.log | xargs -I{} sh -c "cat {} | nc termbin.com 9999 | xargs -r0 printf '{} uploaded to %s'"
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ GOTEST := GO111MODULE=on go test -v
77GO_BIN := ${GOPATH}/bin
88GOBUILD := GO111MODULE=on go build -v
99GOINSTALL := GO111MODULE=on go install -v
10+ GOMOD := GO111MODULE=on go mod
1011
1112COMMIT := $(shell git describe --abbrev=40 --dirty)
1213LDFLAGS := -ldflags "-X $(PKG ) /build.Commit=$(COMMIT ) "
@@ -26,6 +27,12 @@ TEST_FLAGS = -test.timeout=20m
2627
2728UNIT := $(GOLIST ) | $(XARGS ) env $(GOTEST ) $(TEST_FLAGS )
2829
30+ GREEN := "\\033[0;32m"
31+ NC := "\\033[0m"
32+ define print
33+ echo $(GREEN ) $1$(NC )
34+ endef
35+
2936$(LINT_BIN ) :
3037 @$(call print, "Fetching linter")
3138 $(DEPGET ) $(LINT_PKG ) @$(LINT_COMMIT )
@@ -42,6 +49,15 @@ lint: $(LINT_BIN)
4249 @$(call print, "Linting source.")
4350 $(LINT )
4451
52+ mod-tidy :
53+ @$(call print, "Tidying modules.")
54+ $(GOMOD ) tidy
55+
56+ mod-check :
57+ @$(call print, "Checking modules.")
58+ $(GOMOD ) tidy
59+ 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
60+
4561# ============
4662# INSTALLATION
4763# ============
You can’t perform that action at this time.
0 commit comments