$ go run law.go
package main
import "fmt"
// @require: not-empty: len(x) > 0
func Foo(x string) {
if !(len(x) > 0) {
panic("not-empty")
}
fmt.Printf("Hello, %s!\n", x)
}
func main() {
Foo("")
}
Idea: go test
supports -cover
which will rewrite your source code,
annotating it with line coverage statements that provide a way in
which to report code coverage. A new tool that could augment the build
and/or test tools for the purposes of enforcing contracts during
debug, or testing would be really neat. Beyond this basic prototype,
however, I'm not yet sure how to get there...