vburenin/ifacemaker

Fails to parse on gin-gonic/gin

benmoss opened this issue · 4 comments

I was just trying to run ifacemaker on https://github.com/gin-gonic/gin/blob/81007d2ce0176f7a9ce52dd12e56edd7ef40e72c/gin.go and got:

$ ifacemaker -f ./vendor/github.com/gin-gonic/gin/gin.go -s Engine -i Engine -p api
2017/08/08 15:18:34 26:17: expected ';', found 'IDENT' RoutesInfo (and 1 more errors)

Not really sure what's going wrong from this error.

That error is from the go-imports or AST parser, it sees errors in the code that was generated or given to parse. I will take a look, the error should be a little more clear.

FYI, you are trying to generate interface from a composite structure, that is not supported at moment. Generating interfaces for complex structures should be discouraged since it may lead to the long term consequences, such as poor design, increased complexity, hard to test. However, it doesn't mean it is always bad.

My version works, but I didn't test the generated interface.

I have fixed the issue. It happens due to the named return values.

Rad, thanks!