add go coverage

main
hau 2020-08-07 12:50:49 +07:00
parent b6ddf37d2f
commit b9c51411df
1 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,18 @@
# [testing](https://golang.org/pkg/testing/)
## Coverage
```sh
# Write a coverage profile
go test -coverprofile=coverage.out ./...
# Coverage
go tool cover -func=coverage.out
# Coverage with HTML
go tool cover -html=coverage.out
```
## Benchmark
Any benchmark should be careful to prevent **compiler optimization**.