Open HsqSw opened 1 year ago
refer from this sample about variadic parameter handling in gomock https://github.com/golang/mock/blob/main/mockgen/internal/tests/generated_identifier_conflict/bugreport_test.go The solution is you should change mockRedis.EXPECT().MGet(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(context context.Context, cacheKey string, deleteKey string) redis.SliceCmd { to > mockRedis.EXPECT().MGet(gomock.Any(), gomock.Any()).DoAndReturn(func(context context.Context, args ...string) redis.SliceCmd {
redis.MGet only accepts two params. First is context, Second is a string slice. So you can try change as this: mockRedis.EXPECT().MGet(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(context context.Context, cacheKey string, deleteKey string) -> mockRedis.EXPECT().MGet(gomock.Any(), gomock.Any()).DoAndReturn(func(context context.Context, keys string...)