Closed Saku2 closed 2 years ago
Hey @Saku2 ,
I like your idea, but I think if we go this way we have to get rid of uncertainty that you mentioned.
Currently mergeMethods is called in one place only: https://github.com/Saku2/gowrap/blob/1f109acb780b5a64032f545e9da671c9b5fe84fd/generator/generator.go#L374
If the embedded interface listed after the method of a container interface it always wins, which isn't correct and as you mentioned and results in the wrong doc/comment/field names.
Can you please do it in two steps in generator.go, so that first we find embedded interfaces and populate methods list from the embedded interface, and only then we process methods of the outer interface?
Yeah, makes sense. It should work that way now
Since golang allows overlapping methods in embedded interfaces, do not fail if overlapping methods are found when merging embedded interfaces.
This will unfortunately pull Doc and Comment fields from an arbitrary overlapping method, but in my opinion that's better than returning an error.