Go 单元测试相关

https://blog.golang.org/cover
https://golang.org/pkg/testing/
https://golang.org/doc/tutorial/add-a-test

总结:

  1. 单元测试覆盖率,要求*_test.go和func在同一目录下,否则得不到覆盖率
 go test -coverprofile=count.out gitlab.example.com/myapp
 go tool cover -func=count.out

你可能感兴趣的:(Go 单元测试相关)