Skip to content

Commit 44b2a85

Browse files
authored
Merge pull request #42 from klihub/fixes/makefile
Makefile: simplify fmt, lint, and vet targets.
2 parents 46367ec + 446a48d commit 44b2a85

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

Makefile

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ GO_FMT := gofmt
77
GO_VET := $(GO_CMD) vet
88

99
CDI_PKG := $(shell grep ^module go.mod | sed 's/^module *//g')
10-
GO_MODS := $(shell $(GO_CMD) list ./...)
11-
GO_PKGS := $(shell $(GO_CMD) list ./... | grep -v cmd/ | sed 's:$(CDI_PKG):.:g')
1210

1311
BINARIES := bin/cdi
1412

@@ -30,27 +28,18 @@ clean: clean-binaries clean-schema
3028
test: test-gopkgs test-schema
3129

3230
#
33-
# targets for running test prior to filing a PR
31+
# validation targets
3432
#
3533

3634
pre-pr-checks pr-checks: test fmt lint vet
3735

38-
3936
fmt format:
40-
$(Q)report=$$($(GO_FMT) -s -d -w $$(find . -name *.go)); \
41-
if [ -n "$$report" ]; then \
42-
echo "$$report"; \
43-
exit 1; \
44-
fi
37+
$(Q)$(GO_FMT) -s -d -w -e .
4538

4639
lint:
47-
$(Q)status=0; for f in $$(find . -name \*.go); do \
48-
$(GO_LINT) $$f || status=1; \
49-
done; \
50-
exit $$status
51-
40+
$(Q)$(GO_LINT) -set_exit_status ./...
5241
vet:
53-
$(Q)$(GO_VET) $(GO_MODS)
42+
$(Q)$(GO_VET) ./...
5443

5544
#
5645
# build targets
@@ -78,14 +67,7 @@ clean-schema:
7867

7968
# tests for go packages
8069
test-gopkgs:
81-
$(Q)status=0; for pkg in $(GO_PKGS); do \
82-
$(GO_TEST) $$pkg; \
83-
if [ $$? != 0 ]; then \
84-
echo "*** Test FAILED for package $$pkg."; \
85-
status=1; \
86-
fi; \
87-
done; \
88-
exit $$status
70+
$(Q)$(GO_TEST) ./...
8971

9072
# tests for CDI Spec JSON schema
9173
test-schema:

0 commit comments

Comments
 (0)