Commit 181a0837 authored by Dylan Trotter's avatar Dylan Trotter

Add gofmt check to make precommit.

parent 86fafebc
......@@ -79,9 +79,9 @@ run: $(RUNNER)
test: $(ACCEPT_PASS_FILES) $(COMPILER_PASS_FILES) $(COMPILER_EXPR_VISITOR_PASS_FILES) $(COMPILER_STMT_PASS_FILES) $(RUNTIME_PASS_FILE) $(STDLIB_PASS_FILES)
precommit: cover lint test
precommit: cover gofmt lint test
.PHONY: all benchmarks clean cover golint lint precommit pylint run test
.PHONY: all benchmarks clean cover gofmt golint lint precommit pylint run test
# ------------------------------------------------------------------------------
# grumpc compiler
......@@ -141,6 +141,12 @@ cover: $(RUNTIME_COVER_FILE) $(TOOL_BINS)
@bash -c 'comm -12 <(coverparse $< | sed "s/^grumpy/runtime/" | sort) <(git diff --dst-prefix= $(DIFF_COMMIT) | diffrange | sort)' | sort -t':' -k1,1 -k2n,2 | sed 's/$$/: missing coverage/' | tee errors.err
@test ! -s errors.err
build/gofmt.diff: $(wildcard runtime/*.go)
@gofmt -d $^ > $@
gofmt: build/gofmt.diff
@if [ -s $< ]; then echo 'gofmt found errors, run: gofmt -w $(ROOT_DIR)/runtime/*.go'; false; fi
$(GOLINT_BIN):
@go get -u github.com/golang/lint/golint
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment