| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
.PHONY: all todo clean cover generic mem nuke cpu |
| 6 |
|
| 7 |
testbin=b.test |
| 8 |
|
| 9 |
all: editor |
| 10 |
go build |
| 11 |
go vet |
| 12 |
golint . |
| 13 |
go install |
| 14 |
make todo |
| 15 |
|
| 16 |
editor: |
| 17 |
gofmt -l -s -w . |
| 18 |
go test -i |
| 19 |
go test |
| 20 |
|
| 21 |
clean: |
| 22 |
@go clean |
| 23 |
rm -f *~ *.out $(testbin) |
| 24 |
|
| 25 |
cover: |
| 26 |
t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t |
| 27 |
|
| 28 |
cpu: |
| 29 |
go test -c |
| 30 |
./$(testbin) -test.cpuprofile cpu.out |
| 31 |
go tool pprof --lines $(testbin) cpu.out |
| 32 |
|
| 33 |
generic: |
| 34 |
@# writes to stdout a version where the type of key is KEY and the type |
| 35 |
@# of value is VALUE. |
| 36 |
@# |
| 37 |
@# Intended use is to replace all textual occurrences of KEY or VALUE in |
| 38 |
@# the output with your desired types. |
| 39 |
@sed -e 's|interface{}[^{]*/\*K\*/|KEY|g' -e 's|interface{}[^{]*/\*V\*/|VALUE|g' btree.go |
| 40 |
|
| 41 |
mem: |
| 42 |
go test -c |
| 43 |
./$(testbin) -test.bench . -test.memprofile mem.out -test.memprofilerate 1 |
| 44 |
go tool pprof --lines --web --alloc_space $(testbin) mem.out |
| 45 |
|
| 46 |
nuke: clean |
| 47 |
rm -f *.test *.out |
| 48 |
|
| 49 |
todo: |
| 50 |
@grep -n ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* *.go || true |
| 51 |
@grep -n TODO *.go || true |
| 52 |
@grep -n BUG *.go || true |
| 53 |
@grep -n println *.go || true |