feat: checktidy will check the go.mod and go.sum files in circleci
parent
bbd7153cca
commit
0e14b63425
|
@ -44,6 +44,7 @@ jobs:
|
|||
- run: make test-go # This uses the test cache so it may succeed or fail quickly.
|
||||
- run: make vet
|
||||
- run: make checkfmt
|
||||
- run: make checktidy
|
||||
- run: make test-go-race # This doesn't use the test cache, and will not complete quickly.
|
||||
# TODO add these checks to the Makefile
|
||||
# - run: go get -v -t -d ./...
|
||||
|
|
10
Makefile
10
Makefile
|
@ -107,9 +107,15 @@ chronograf/ui/build:
|
|||
fmt: $(SOURCES_NO_VENDOR)
|
||||
gofmt -w -s $^
|
||||
|
||||
checkfmt: $(SOURCES_NO_VENDOR)
|
||||
checkfmt:
|
||||
./etc/checkfmt.sh
|
||||
|
||||
tidy:
|
||||
GO111MODULE=on go mod tidy
|
||||
|
||||
checktidy:
|
||||
./etc/checktidy.sh
|
||||
|
||||
chronograf/dist/dist_gen.go: chronograf/ui/build $(UISOURCES)
|
||||
$(GO_GENERATE) ./chronograf/dist/...
|
||||
|
||||
|
@ -167,4 +173,4 @@ run: chronogiraffe
|
|||
|
||||
|
||||
# .PHONY targets represent actions that do not create an actual file.
|
||||
.PHONY: all subdirs $(SUBDIRS) chronograf/ui run fmt test test-go test-js test-go-race bench clean node_modules vet nightly chronogiraffe
|
||||
.PHONY: all subdirs $(SUBDIRS) chronograf/ui run fmt checkfmt tidy checktidy test test-go test-js test-go-race bench clean node_modules vet nightly chronogiraffe
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
export GO111MODULE=on
|
||||
go mod tidy
|
||||
|
||||
if ! git --no-pager diff --exit-code -- go.mod go.sum; then
|
||||
>&2 echo "modules are not tidy, please run 'go mod tidy'"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue