推荐Golang的assert库@H_301_1@
(金庆的专栏 2018.5)@H_301_1@
https://github.com/aurelien-rainone/assertgo@H_301_1@
Conditionally compiled assertions in Go @H_301_1@
和C++中的assert()一样,这个是带条件编译的,必须使用 debug 才能启用。@H_301_1@
如:@H_301_1@
$ go run -tags debug main.go
使用示例:@H_301_1@
assert.True(true,"never printed")