Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .PHONY: all clean cover cpu editor internalError later mem nuke todo edit
  2. grep=--include=*.go --include=*.l --include=*.y --include=*.yy
  3. ngrep='TODOOK\|parser\.go\|scanner\.go\|.*_string\.go'
  4. all: editor
  5. go vet 2>&1 | grep -v $(ngrep) || true
  6. golint 2>&1 | grep -v $(ngrep) || true
  7. make todo
  8. unused . || true
  9. misspell *.go
  10. gosimple || true
  11. maligned || true
  12. unconvert -apply
  13. clean:
  14. go clean
  15. rm -f *~ *.test *.out
  16. cover:
  17. t=$(shell mktemp) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
  18. cpu: clean
  19. go test -run @ -bench . -cpuprofile cpu.out
  20. go tool pprof -lines *.test cpu.out
  21. edit:
  22. @touch log
  23. @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi
  24. editor:
  25. gofmt -l -s -w *.go
  26. go test -i
  27. go test 2>&1 | tee log
  28. go install
  29. internalError:
  30. egrep -ho '"internal error.*"' *.go | sort | cat -n
  31. later:
  32. @grep -n $(grep) LATER * || true
  33. @grep -n $(grep) MAYBE * || true
  34. mem: clean
  35. go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
  36. go tool pprof -lines -web -alloc_space *.test mem.out
  37. nuke: clean
  38. go clean -i
  39. todo:
  40. @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
  41. @grep -nr $(grep) TODO * | grep -v $(ngrep) || true
  42. @grep -nr $(grep) BUG * | grep -v $(ngrep) || true
  43. @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true