Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 .
  9. -misspell *.go
  10. -gosimple
  11. clean:
  12. go clean
  13. rm -f *~ *.test *.out
  14. cover:
  15. t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
  16. cpu: clean
  17. go test -run @ -bench . -cpuprofile cpu.out
  18. go tool pprof -lines *.test cpu.out
  19. edit:
  20. @ 1>/dev/null 2>/dev/null gvim -p Makefile *.go
  21. editor:
  22. gofmt -l -s -w *.go
  23. go test
  24. go build
  25. generic:
  26. @# writes to stdout a version where the type of key is KEY and the type
  27. @# of value is VALUE.
  28. @#
  29. @# Intended use is to replace all textual occurrences of KEY or VALUE in
  30. @# the output with your desired types.
  31. @sed -e 's|interface{}[^{]*/\*K\*/|KEY|g' -e 's|interface{}[^{]*/\*V\*/|VALUE|g' btree.go
  32. internalError:
  33. egrep -ho '"internal error.*"' *.go | sort | cat -n
  34. later:
  35. grep -n $(grep) LATER * || true
  36. grep -n $(grep) MAYBE * || true
  37. mem: clean
  38. go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
  39. go tool pprof -lines -web -alloc_space *.test mem.out
  40. nuke: clean
  41. go clean -i
  42. todo:
  43. grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
  44. grep -nr $(grep) TODO * | grep -v $(ngrep) || true
  45. grep -nr $(grep) BUG * | grep -v $(ngrep) || true
  46. grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true