gcraft#
Go Code Craftsman — a CLI that reads your struct and interface definitions with go/ast and generates the boilerplate you’d otherwise write by hand: Builder, Validator, Clone, and Mock.
No reflection at runtime. No code templates to maintain. Just plain, idiomatic Go you can read, debug, and check into version control.
go install github.com/Mahdyaralipor/gcraft/cmd/gcraft@latest
gcraft generate -type User -src ./user.gou := NewUserBuilder().
WithName("Ada").
WithEmail("ada@example.com").
Build()What it generates#
| Feature | Flag | What you get |
|---|---|---|
| Builder | -builder | Fluent With...() methods for constructing instances |
| Validator | -validate | A Validate() error method |
| Clone | -clone | A Clone() deep-copy method |
| Mock | -mock | A mock implementation, for interfaces |
All four are generated by default — disable any of them with =false.
👉 Start with Installation, then Getting Started.