Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright (c) 2014 The sortutil Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style
  3. # license that can be found in the LICENSE file.
  4. .PHONY: all clean cover cpu editor internalError later mem nuke todo edit
  5. grep=--include=*.go --include=*.l --include=*.y --include=*.yy
  6. ngrep='TODOOK\|parser\.go\|scanner\.go\|.*_string\.go'
  7. all: editor
  8. go vet 2>&1 | grep -v $(ngrep) || true
  9. golint 2>&1 | grep -v $(ngrep) || true
  10. make todo
  11. unused . || true
  12. misspell *.go
  13. gosimple || true
  14. maligned || true
  15. unconvert -apply
  16. clean:
  17. go clean
  18. rm -f *~ *.test *.out
  19. cover:
  20. t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
  21. cpu: clean
  22. go test -run @ -bench . -cpuprofile cpu.out
  23. go tool pprof -lines *.test cpu.out
  24. edit:
  25. @ 1>/dev/null 2>/dev/null gvim -p Makefile go.mod builder.json *.go
  26. editor:
  27. unconvert -apply || true
  28. gofmt -l -s -w *.go
  29. go test -i
  30. go test 2>&1 | tee log
  31. go install
  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