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.go
u := NewUserBuilder().
    WithName("Ada").
    WithEmail("ada@example.com").
    Build()

What it generates#

FeatureFlagWhat you get
Builder-builderFluent With...() methods for constructing instances
Validator-validateA Validate() error method
Clone-cloneA Clone() deep-copy method
Mock-mockA mock implementation, for interfaces

All four are generated by default — disable any of them with =false.

👉 Start with Installation, then Getting Started.

GitHub · Report an issue