khenaidoo | ab1f7bd | 2019-11-14 14:00:27 -0500 | [diff] [blame] | 1 | BRANCH=`git rev-parse --abbrev-ref HEAD` |
| 2 | COMMIT=`git rev-parse --short HEAD` |
| 3 | GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)" |
| 4 | |
| 5 | default: build |
| 6 | |
| 7 | race: |
| 8 | @TEST_FREELIST_TYPE=hashmap go test -v -race -test.run="TestSimulate_(100op|1000op)" |
| 9 | @echo "array freelist test" |
| 10 | @TEST_FREELIST_TYPE=array go test -v -race -test.run="TestSimulate_(100op|1000op)" |
| 11 | |
| 12 | fmt: |
| 13 | !(gofmt -l -s -d $(shell find . -name \*.go) | grep '[a-z]') |
| 14 | |
| 15 | # go get honnef.co/go/tools/simple |
| 16 | gosimple: |
| 17 | gosimple ./... |
| 18 | |
| 19 | # go get honnef.co/go/tools/unused |
| 20 | unused: |
| 21 | unused ./... |
| 22 | |
| 23 | # go get github.com/kisielk/errcheck |
| 24 | errcheck: |
| 25 | @errcheck -ignorepkg=bytes -ignore=os:Remove go.etcd.io/bbolt |
| 26 | |
| 27 | test: |
| 28 | TEST_FREELIST_TYPE=hashmap go test -timeout 20m -v -coverprofile cover.out -covermode atomic |
| 29 | # Note: gets "program not an importable package" in out of path builds |
| 30 | TEST_FREELIST_TYPE=hashmap go test -v ./cmd/bbolt |
| 31 | |
| 32 | @echo "array freelist test" |
| 33 | |
| 34 | @TEST_FREELIST_TYPE=array go test -timeout 20m -v -coverprofile cover.out -covermode atomic |
| 35 | # Note: gets "program not an importable package" in out of path builds |
| 36 | @TEST_FREELIST_TYPE=array go test -v ./cmd/bbolt |
| 37 | |
| 38 | .PHONY: race fmt errcheck test gosimple unused |