Skip to content

Commit 5db9874

Browse files
Makefile: introduce fmt-check phony target
1 parent 4d93d11 commit 5db9874

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ fmt: $(GOIMPORTS_BIN)
115115
@$(call print, "Formatting source.")
116116
gofmt -l -w -s $(GOFILES_NOVENDOR)
117117

118+
#? fmt-check: Make sure source code is formatted and imports are correct
119+
fmt-check: fmt
120+
@$(call print, "Checking fmt results.")
121+
if test -n "$$(git status --porcelain)"; then echo "code not formatted correctly, please run `make fmt` again!"; git status; git diff; exit 1; fi
122+
118123
#? lint: Lint source
119124
lint: $(LINT_BIN)
120125
@$(call print, "Linting source.")

0 commit comments

Comments
 (0)