gitlab.com/infor-cloud/martian-cloud/tharsis/go-limiter@v0.0.0-20230411193226-3247984d5abc/Makefile (about) 1 VETTERS = "asmdecl,assign,atomic,bools,buildtag,cgocall,composites,copylocks,errorsas,httpresponse,loopclosure,lostcancel,nilfunc,printf,shift,stdmethods,structtag,tests,unmarshal,unreachable,unsafeptr,unusedresult" 2 GOFMT_FILES = $(shell go list -f '{{.Dir}}' ./...) 3 4 benchmarks: 5 @(cd benchmarks/ && go test -bench=. -benchmem -benchtime=1s ./...) 6 .PHONY: benchmarks 7 8 fmtcheck: 9 @command -v goimports > /dev/null 2>&1 || (cd tools/ && go get golang.org/x/tools/cmd/goimports) 10 @CHANGES="$$(goimports -d $(GOFMT_FILES))"; \ 11 if [ -n "$${CHANGES}" ]; then \ 12 echo "Unformatted (run goimports -w .):\n\n$${CHANGES}\n\n"; \ 13 exit 1; \ 14 fi 15 @# Annoyingly, goimports does not support the simplify flag. 16 @CHANGES="$$(gofmt -s -d $(GOFMT_FILES))"; \ 17 if [ -n "$${CHANGES}" ]; then \ 18 echo "Unformatted (run gofmt -s -w .):\n\n$${CHANGES}\n\n"; \ 19 exit 1; \ 20 fi 21 .PHONY: fmtcheck 22 23 spellcheck: 24 @command -v misspell > /dev/null 2>&1 || (cd tools/ && go get github.com/client9/misspell/cmd/misspell) 25 @misspell -locale="US" -error -source="text" **/* 26 .PHONY: spellcheck 27 28 staticcheck: 29 @command -v staticcheck > /dev/null 2>&1 || (cd tools/ && go get honnef.co/go/tools/cmd/staticcheck) 30 @staticcheck -checks="all" -tests $(GOFMT_FILES) 31 .PHONY: staticcheck 32 33 test: 34 @go test \ 35 -count=1 \ 36 -short \ 37 -timeout=5m \ 38 -vet="${VETTERS}" \ 39 ./... 40 .PHONY: test 41 42 test-acc: 43 @go test \ 44 -count=1 \ 45 -race \ 46 -timeout=10m \ 47 -vet="${VETTERS}" \ 48 ./... 49 .PHONY: test-acc