rjeczalik / interfaces

Code generation tools for Go.
MIT License
420 stars 31 forks source link

Interfacer generates invalid code when package name contains hyphen #37

Open paprikati opened 2 years ago

paprikati commented 2 years ago

We've tried to run interfacer against github.com/PagerDuty/go-pagerduty.Client. When one of the function arguments is a package name, it generates:

    ListAuditRecordsPaginated(context.Context, pagerduty.ListAuditRecordsOptions, func(go-pagerduty.AuditRecord) bool) ([]pagerduty.AuditRecord, error)

however, go-pagerduty isn't a valid package name. Would it be possible to pass args to tell interfacer which package name to use in this scenario?

rjeczalik commented 1 year ago

Would it be possible to pass args to tell interfacer which package name to use in this scenario?

I think interfaces should be smart enough to read the actual name of the package. Right now it does a dumb thing - it tries to infer the name from the (file-) import path.