rjeczalik / interfaces

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

skipping test defined methods, or add -exclude flat #39

Open Liooo opened 1 year ago

Liooo commented 1 year ago

I'm trying to generate an interface for a struct in an external library, but they define additional methods in test file, and I don't want the generated interface to have those.

e.g.

// --- external.go ---
package external

type TheirStruct struct{}

// we want this
func (t TheirStruct) SomeMethod() {
} 

// --- external_test.go ---
package external

 // but we do not want this
func (t TheirStruct) SomeTestMethod() {
}

Would be great if this tool automatically skips test file defined methods, or have an -exclude flag that takes names of methods to be skipped.