Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down