matryer / moq

Interface mocking tool for go generate
http://bit.ly/meetmoq
MIT License
1.99k stars 126 forks source link

Failing mock generation with two arguments of type time.Time #144

Closed breml closed 3 years ago

breml commented 3 years ago

If I generate a mock with moq version 0.2.0 for a function with two not named arguments of type time.Time, the generated mock has a duplicate declaration for TimeMoqParam time.Time.

Minimal example:

type Dummy interface {
    F(time.Time, time.Time)
}

moq command:

moq -fmt goimports -pkg main -out dummy_mock.go . Dummy

Resulting mock:


...
type DummyMock struct {
    // FFunc mocks the F method.
    FFunc func(timeMoqParam time.Time, timeMoqParam time.Time)

    // calls tracks calls to the methods.
    calls struct {
        // F holds details about calls to the F method.
        F []struct {
            // TimeMoqParam is the timeMoqParam argument value.
            TimeMoqParam time.Time
            // TimeMoqParam is the timeMoqParam argument value.
            TimeMoqParam time.Time
        }
    }
    lockF sync.RWMutex
}
...