github.com/alimy/mir/v4@v4.1.0/Makefile (about) 1 GOFMT ?= gofmt -s -w 2 GOFILES := $(shell find . -name "*.go" -type f) 3 4 .PHONY: default 5 default: ci 6 7 .PHONY: ci 8 ci: misspell vet 9 go test ./... 10 11 .PHONY: build 12 build: fmt 13 go build -o mir mirc/main.go 14 15 .PHONY: test 16 test: fmt misspell vet 17 go test ./... 18 19 .PHONY: gen-docs 20 gen-docs: 21 @-rm -rf docs/public 22 @cd docs && hugo --minify --baseURL "https://alimy.me/mir/" && cd - 23 24 .PHONY: run-docs 25 run-docs: 26 @cd docs && hugo serve --minify && cd - 27 28 .PHONY: vet 29 vet: 30 go vet ./... 31 32 .PHONY: fmt-check 33 fmt-check: 34 @diff=$$($(GOFMT) -d $(GOFILES)); \ 35 if [ -n "$$diff" ]; then \ 36 echo "Please run 'make fmt' and commit the result:"; \ 37 echo "$${diff}"; \ 38 exit 1; \ 39 fi; 40 41 .PHONY: lint 42 lint: 43 @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ 44 go get -u golang.org/x/lint/golint; \ 45 fi 46 for PKG in $(PACKAGES); do golint -min_confidence 1.0 -set_exit_status $$PKG || exit 1; done; 47 48 .PHONY: misspell-check 49 misspell-check: 50 @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ 51 GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell; \ 52 fi 53 misspell -error $(GOFILES) 54 55 .PHONY: misspell 56 misspell: 57 @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ 58 GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell; \ 59 fi 60 misspell -w $(GOFILES) 61 62 .PHONY: fmt 63 fmt: 64 $(GOFMT) $(GOFILES) 65 66 .PHONY: tools 67 tools: 68 GO111MODULE=off go get golang.org/x/lint/golint 69 GO111MODULE=off go get github.com/client9/misspell/cmd/misspell