rjeczalik / interfaces

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

Ignore specified embedded fields when generating an interface #16

Closed hgl closed 1 year ago

hgl commented 4 years ago

Would you accept a PR that allows specifying ignored embedded fields?

My use case:

type DB struct {
  *underlyingDB.Client
}

func (db *DB) CreateUser() {}

I'd like to exclude methods from underlyingDB.Client.

do you think -ignore Field1,Field2 would be a good argument format?

hgl commented 4 years ago

Hmm, looks like this is not easy to implement performatively.

I initially thought listing the field names after if !field.Anonymous() should be enough, but it seems the external packages are still walked.

rjeczalik commented 1 year ago

I think it would be good addition