uber-go / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
1.85k stars 106 forks source link

Flag for interface exclusion #68

Closed tulzke closed 10 months ago

tulzke commented 10 months ago

Please add the ability to exclude interfaces, if source mode of mockgen is used.

This can be useful in the following case:

package segmentation

//go:generate mockgen -destination=segmenter_mock.go -package=segmentation -source=segmenter.go

// need to exlude this interface, because it is constraint
type Segment interface {
    ~int
}

type Segmenter[V Segment] interface {
    Segment(code string) V
}

You can do this by passing a flag or using a comment like // gomock:exclude