chavacava/dbc4go
Design by Contract for Go
This tool helps Go developers ensure their code behaves exactly as intended by automatically checking specified conditions at runtime. You annotate your Go functions and structs with contracts embedded in comments, defining what inputs are valid and what outputs are guaranteed. The tool then processes your code, generating additional checks that will panic if these contracts are violated during execution, making it easier to catch bugs related to function inputs, outputs, or object state.
No commits in the last 6 months.
Use this if you are a Go developer looking to add an extra layer of automated validation and bug detection to your codebase, beyond what standard unit tests might cover, by enforcing explicit pre-conditions, post-conditions, and invariants.
Not ideal if you are not a Go developer or if you prefer to enforce code correctness solely through rigorous testing, static analysis, or type systems without runtime overhead.
Stars
35
Forks
1
Language
Go
License
MIT
Category
Last pushed
Mar 31, 2025
Commits (30d)
0
Get this data via API
curl "https://pt-edge.onrender.com/api/v1/quality/ai-coding/chavacava/dbc4go"
Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.
Higher-rated alternatives
googleapis/gapic-generator-python
Generate Python API client libraries from Protocol Buffers.
zeromicro/go-zero
A cloud-native Go microservices framework with cli tool for productivity.
omissis/go-jsonschema
A tool to generate Go data types from JSON Schema definitions.
openconfig/ygot
A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling
mailru/easyjson
Fast JSON serializer for golang.