推荐Golang的assert库

推荐Golang的assert库

(金庆的专栏 2018.5)

https://github.com/aurelien-rainone/assertgo

Conditionally compiled assertions in Go

和C++中的assert()一样,这个是带条件编译的,必须使用 debug 才能启用。

如:

$ go run -tags debug main.go

使用示例:

assert.True(true, "never printed")

猜你喜欢

转载自blog.csdn.net/jq0123/article/details/80306573
今日推荐