interfaces icon indicating copy to clipboard operation
interfaces copied to clipboard

Ignore specified embedded fields when generating an interface

Open hgl opened this issue 5 years ago • 2 comments

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 avatar Jan 04 '20 07:01 hgl

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.

hgl avatar Jan 04 '20 07:01 hgl

I think it would be good addition

rjeczalik avatar Aug 07 '22 18:08 rjeczalik