func Ensure(b bool, message ...interface{}) {
	dbc_panic("ENSURE", b, message...)
}
Ensure checks the postconditions are satisfied before returning
to the caller.

Example Code

type Data struct {
a int
}

func (*d Data) Set(a int) {
d.a = a
godbc.Ensure(d.a == a)
}
package godbc
import (
	"errors"
	"fmt"
	"runtime"
)
type InvariantSimpleTester interface {
	Invariant() bool
}
type InvariantTester interface {
	InvariantSimpleTester
	String() string
}
func dbc_panic(dbc_func_name string, b bool, message ...interface{}) {
	if !b {
		pc, file, line, _ := runtime.Caller(2)
		caller_func_info := runtime.FuncForPC(pc)
		error_string := fmt.Sprintf("%s:\n\r\tfunc (%s) 0x%x\n\r\tFile %s:%d",
			dbc_func_name,
			caller_func_info.Name(),
			pc,
			file,
			line)
		if len(message) > 0 {
			error_string += fmt.Sprintf("\n\r\tInfo: %+v", message)
		}
		err := errors.New(error_string)
		panic(err)
	}
}
func Require(b bool, message ...interface{}) {
	dbc_panic("REQUIRE", b, message...)
}