Actual behavior A clear and concise description of what the bug is.
After #558, it forces a check for the number of argument for Do function. However, it doesn't work for variadic params. For example we have
UpdateAndWait(name, template string, opts ...stackset.CreateOrUpdateOption) error
and in the unit test we check
m.EXPECT().UpdateAndWait(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
Return(nil).
Do(func(_, template string, _, _, _, _, _ stackset.CreateOrUpdateOption) {
configToDeploy, err := stack.AppConfigFrom(&template)
require.NoError(t, err)
require.ElementsMatch(t, []string{"firsttest"}, configToDeploy.Services)
require.Empty(t, configToDeploy.Accounts, "config account list should be empty")
require.Equal(t, 2, configToDeploy.Version)
})
simply there's no way for us to use Do to validate one of the variadic param we pass.
Additional Information
- gomock mode (reflect or source):
- gomock version or git ref: v1.6.0
- golang version: go1.16.4 darwin/amd64