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
23
23
24
24
script :
25
25
- export GO111MODULE=on
26
- - make lint unit build
26
+ - make lint unit build mod-check
27
27
28
28
after_script :
29
29
- 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
7
7
GO_BIN := ${GOPATH}/bin
8
8
GOBUILD := GO111MODULE=on go build -v
9
9
GOINSTALL := GO111MODULE=on go install -v
10
+ GOMOD := GO111MODULE=on go mod
10
11
11
12
COMMIT := $(shell git describe --abbrev=40 --dirty)
12
13
LDFLAGS := -ldflags "-X $(PKG ) /build.Commit=$(COMMIT ) "
@@ -26,6 +27,12 @@ TEST_FLAGS = -test.timeout=20m
26
27
27
28
UNIT := $(GOLIST ) | $(XARGS ) env $(GOTEST ) $(TEST_FLAGS )
28
29
30
+ GREEN := "\\033[0;32m"
31
+ NC := "\\033[0m"
32
+ define print
33
+ echo $(GREEN ) $1$(NC )
34
+ endef
35
+
29
36
$(LINT_BIN ) :
30
37
@$(call print, "Fetching linter")
31
38
$(DEPGET ) $(LINT_PKG ) @$(LINT_COMMIT )
@@ -42,6 +49,15 @@ lint: $(LINT_BIN)
42
49
@$(call print, "Linting source.")
43
50
$(LINT )
44
51
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
+
45
61
# ============
46
62
# INSTALLATION
47
63
# ============
You can’t perform that action at this time.
0 commit comments