package main
type s struct{}
//go:generate moq -out i_test.go . i
type i interface {
m(s s)
}
moq generates:
// m calls mFunc.
func (mock *iMock) m(s s) { // Type s is shadowed.
if mock.mFunc == nil {
panic("iMock.mFunc: method is nil but i.m was just called")
}
callInfo := struct {
S s // Compiler error: s (variable of type s) is not a type.
}{
S: s,
}
mock.lockm.Lock()
mock.calls.m = append(mock.calls.m, callInfo)
mock.lockm.Unlock()
mock.mFunc(s)
}
This may (and arguably should) be remedied by changing the interface method to m(somethingDescriptive s), yet it's an invalid output generated from a valid input.
Please consider the following snippet:
moq generates:
This may (and arguably should) be remedied by changing the interface method to
m(somethingDescriptive s)
, yet it's an invalid output generated from a valid input.