ci: add a check for non-vendored packages

This check fails the lint-go CI job if nomad references a package that
is not vendored.
This commit is contained in:
Mahmood Ali 2020-03-09 15:06:47 -04:00
parent 8f1fc0fc56
commit b6f3effc5b
1 changed files with 3 additions and 0 deletions

View File

@ -179,6 +179,9 @@ check: ## Lint the source code
@echo "==> Check API package is isolated from rest"
@if go list --test -f '{{ join .Deps "\n" }}' ./api | grep github.com/hashicorp/nomad/ | grep -v -e /vendor/ -e /nomad/api/ -e nomad/api.test; then echo " /api package depends the ^^ above internal nomad packages. Remove such dependency"; exit 1; fi
@echo "==> Check non-vendored packages"
@if go list --test -tags "$(GO_TAGS)" -f '{{join .Deps "\n"}}' . | grep -v github.com/hashicorp/nomad.test | xargs go list -tags "$(GO_TAGS)" -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | grep -v -e github.com/hashicorp/nomad; then echo " found referenced packages ^^ that are not vendored"; exit 1; fi
.PHONY: checkscripts
checkscripts: ## Lint shell scripts
@echo "==> Linting scripts..."