vburenin / ifacemaker

Generate interfaces from structure methods.
Apache License 2.0
320 stars 43 forks source link

Fix struct validation for multiple files #65

Open mikeschinkel opened 8 months ago

mikeschinkel commented 8 months ago

Using the following command line where persister contains files generated by sqlc, your latest commit in master fails to correctly generate the file ./app/query.iface.go because it cannot find the struct Queries in the first .go file.

ifacemaker -f ./persister/*.go -s Queries -i DataStoreQueries -p app -o ./app/query.iface.go

I moved the if !validateStructType(...) {...} to after the for loop and passed allDeclaredTypes instead of types and it allowed the file to be generated. I believe this is all that is needed for a fix.