hel
hel copied to clipboard
[feature request] Specify 'do not generate' on an interface
It'd be nice to 'opt-out' of generating some interfaces with something like
hel: no
Heh, or whatever
Would you be okay with a flag for hel? It would alter your //go:generate
command without requiring you to include details about your mock generation in your types.
package foo
//go:generate --skip '.*Reader'
I really like the hel: no
idea, but I can't think of a good way to build it out. Both of the ways I was thinking of have some pretty big detriments:
// hel: no
type Reader interface {
Read(buf []byte) (n int, err error)
}
In the above example, "hel: no" is considered part of the documentation. This is a pretty big detriment.
// hel: no
type Reader interface{
Read(buf []byte) (n int, err error)
}
In the above example, the "hel: no" comment is decoupled from the Reader
type, and parsing becomes very, very difficult. In addition, I would not expect it to be problematic if I added a new interface type (which I do want a mock for) between the comment and the type.
I would +1 on the flag. I think having the comments in production code for mock instruction is weird anyways.
Comments that are code is weird in general. I'm +1 on a flag.