This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
Incorrect check for function arguments for Do and DoAndReturn in 1.6 #637
Closed
Description
Actual behavior
In mock version 1.6, PR #558 added check to compare the function arguments and log if it mismatches. This is causing problems in which the variadic (...) argument in the function is counted as a fixed argument.
func test(b ...interface{}) {}
func main() {
typ := reflect.TypeOf(test)
fmt.Printf("NumIn: %d", typ.NumIn()) // this prints NumIn: 1
}
Due to this, if the Do function is called without any arguments, the function will fail due to arguments mismatch, even though the no argument behavior is expected.
Expected behavior
Ignore variadic argument when counting expected function arguments.
Note: This issue was not seen in 1.5. Most probably PR #558 caused this.
To Reproduce Steps to reproduce the behavior
N/A
Additional Information
- gomock mode (reflect or source):
- gomock version or git ref:
- golang version:
Triage Notes for the Maintainers