Browse Source

Add fmt command to makefile

master
Riyyi 1 week ago
parent
commit
39b8d9ac4b
  1. 7
      Makefile

7
Makefile

@ -1,4 +1,4 @@
.PHONY: build fmt vet check githook install uninstall .PHONY: build fmt fmtcheck vet check githook install uninstall
PKG := github.com/Riyyi/declpac PKG := github.com/Riyyi/declpac
BIN := declpac BIN := declpac
@ -15,6 +15,9 @@ build:
go build -o $(BUILD) ./cmd/declpac go build -o $(BUILD) ./cmd/declpac
fmt: fmt:
@gofmt -w cmd pkg
fmtcheck:
@if [ -z "$(STAGED_GO)" ]; then exit 0; fi; \ @if [ -z "$(STAGED_GO)" ]; then exit 0; fi; \
unformatted=$$(gofmt -l $(STAGED_GO)); \ unformatted=$$(gofmt -l $(STAGED_GO)); \
if [ -n "$$unformatted" ]; then \ if [ -n "$$unformatted" ]; then \
@ -26,7 +29,7 @@ vet:
@if [ -z "$(STAGED_GO)" ]; then exit 0; fi; \ @if [ -z "$(STAGED_GO)" ]; then exit 0; fi; \
go vet $(STAGED_PKGS) go vet $(STAGED_PKGS)
check: fmt vet check: fmtcheck vet
githook: githook:
@mkdir -p .git/hooks @mkdir -p .git/hooks

Loading…
Cancel
Save