Closed jdmeyer3 closed 1 year ago
Could you try out the anon-structs
branch? This branch should include a fix for this, but I don't know if this covers all possible definitions of unnamed structs.
You can run it directly with:
$ go run github.com/jmattheis/goverter/cmd/goverter@anon-structs ./path/dir/with/goverter/inteface
It works for most of my use cases, the only failure was when the anon struct was a pointer
Reproducible code
// goverter:converter
type Converter interface {
ConvertHouse(source DBHouseNames) APIHouseNames
}
type DBHouseNames struct {
House *struct {
Name string
Owner *string
}
}
type APIHouseNames struct {
House *struct {
Name string
Owner *string
}
}
And thank you very much for your prompt responses. It is greatly appreciated.
Yeah, no problem (:, could you retry with the anon-structs2
branch?
$ go run github.com/jmattheis/goverter/cmd/goverter@anon-structs2 ./path/dir/with/goverter/inteface
Initial code generation works, I will need a little time to verify it returns the expected result due to the size of the structs I'm dealing with. Again, thanks for hoping on this.
Fixed in v0.12.0
Is your feature request related to a problem? Please describe. There are several structs I cannot edit and have Nested structs. For example
The resulting code panics because goverter does not support *types.Struct.
Describe the solution you'd like Goverter to handle nested structs