Registry / testing / lpabon-godbc

lpabon-godbc

JSON →
library1.1.0gogounverified

Package godbc provides design-by-contract assertions for Go, including preconditions, postconditions, and invariants.

go get github.com/lpabon/godbc
INSTALL
IMPORT
SIG · LPABON-GODBC
L
lpabon-godbc
testinggov1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

godbc
github.com/lpabon/godbc

Demonstrates precondition and postcondition checks.

package main import ( "github.com/lpabon/godbc" ) func Divide(a, b int) int { godbc.Require(b != 0, "divisor must not be zero") result := a / b godbc.Ensure(result*b == a, "division result must be correct") return result } func main() { Divide(10, 2) }
Debug
Known issues
gotchaDisabled by default in production builds with 'prod' build tag
fix
Use 'go build -tags prod' to disable assertions for performance.
affects: >=1.0.0
Upgrade
Version history
1.1.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
lpabon-godbc — go get lpabon-godbc · libregistry