Should not resolve type alias when generate mock files
Actual behavior A clear and concise description of what the bug is.
we have an interface that uses "github.com/tikv/client-go/v2/tikv".Codec. And that type is defined as
under "github.com/tikv/client-go/v2/tikv":
import "github.com/tikv/client-go/v2/internal/apicodec"
...
type Codec = apicodec.Codec
In the generated mock files, it directly imports "github.com/tikv/client-go/v2/internal/apicodec" which is not allowed for the non-internal usage.
Expected behavior A clear and concise description of what you expected to happen.
It should import "github.com/tikv/client-go/v2/tikv" instead
To Reproduce Steps to reproduce the behavior
- ...
- ...
Additional Information
- gomock mode (reflect or source): default value
- gomock version or git ref: v0.5.0
- golang version: 1.23
Triage Notes for the Maintainers
Hey @lance6716 - how is the Codec type being used in terms of the interface you're trying to mock? Can you show us:
- The definition of the interface you're trying to mock
- The mockgen command you're running
Thanks
@JacobOaks I pushed example code here https://github.com/lance6716/mock/tree/show216/example
The command is mockgen -package mock . Foo > ./mock/gen.go
And can you take a look at https://github.com/uber-go/mock/pull/171 ? Thanks.