diff --git a/Makefile b/Makefile index eda243aa..0be9359b 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,6 @@ GO_FMT := gofmt GO_VET := $(GO_CMD) vet CDI_PKG := $(shell grep ^module go.mod | sed 's/^module *//g') -GO_MODS := $(shell $(GO_CMD) list ./...) -GO_PKGS := $(shell $(GO_CMD) list ./... | grep -v cmd/ | sed 's:$(CDI_PKG):.:g') BINARIES := bin/cdi @@ -30,27 +28,18 @@ clean: clean-binaries clean-schema test: test-gopkgs test-schema # -# targets for running test prior to filing a PR +# validation targets # pre-pr-checks pr-checks: test fmt lint vet - fmt format: - $(Q)report=$$($(GO_FMT) -s -d -w $$(find . -name *.go)); \ - if [ -n "$$report" ]; then \ - echo "$$report"; \ - exit 1; \ - fi + $(Q)$(GO_FMT) -s -d -w -e . lint: - $(Q)status=0; for f in $$(find . -name \*.go); do \ - $(GO_LINT) $$f || status=1; \ - done; \ - exit $$status - + $(Q)$(GO_LINT) -set_exit_status ./... vet: - $(Q)$(GO_VET) $(GO_MODS) + $(Q)$(GO_VET) ./... # # build targets @@ -78,14 +67,7 @@ clean-schema: # tests for go packages test-gopkgs: - $(Q)status=0; for pkg in $(GO_PKGS); do \ - $(GO_TEST) $$pkg; \ - if [ $$? != 0 ]; then \ - echo "*** Test FAILED for package $$pkg."; \ - status=1; \ - fi; \ - done; \ - exit $$status + $(Q)$(GO_TEST) ./... # tests for CDI Spec JSON schema test-schema: