hel icon indicating copy to clipboard operation
hel copied to clipboard

[feature request] Specify 'do not generate' on an interface

Open jeanbza opened this issue 8 years ago • 3 comments

It'd be nice to 'opt-out' of generating some interfaces with something like

hel: no

Heh, or whatever

jeanbza avatar Nov 07 '16 23:11 jeanbza

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.

nelsam avatar Nov 27 '16 23:11 nelsam

I would +1 on the flag. I think having the comments in production code for mock instruction is weird anyways.

poy avatar Dec 01 '16 02:12 poy

Comments that are code is weird in general. I'm +1 on a flag.

jasonkeene avatar Dec 02 '16 02:12 jasonkeene