Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Generates non-compilable code #370

Closed
ZergsLaw opened this issue Dec 22, 2019 · 2 comments · Fixed by #371
Closed

Generates non-compilable code #370

ZergsLaw opened this issue Dec 22, 2019 · 2 comments · Fixed by #371

Comments

@ZergsLaw
Copy link
Contributor

I only need to document one specific parameter in the interface, an example:

Search(_ Ctx, _ Auth, query string,_ Lang,_ Page)

Actual behavior Generates non-compilable code, sample:

(m *MockSearcher) TrackByIDs(_ Ctx, _ UserID, subsUserIDs []UserID, _ []ulid.ULID) ([]TrackInfo, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "TrackByIDs", _, _, subsUserIDs, _)
	ret0, _ := ret[0].([]TrackInfo)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

Expected behavior I expected to see that result.

(m *MockSearcher) TrackByIDs(arg1 Ctx, arg2 UserID, subsUserIDs []UserID, arg4 []ulid.ULID) ([]TrackInfo, error) {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "TrackByIDs", _, _, subsUserIDs, _)
	ret0, _ := ret[0].([]TrackInfo)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}

To Reproduce Steps to reproduce the behavior

  1. Write interface:
type Sample interface {
	Test(val int, _ string) 
}
  1. Generate mock.

Additional Information

  • gomock version or git ref: 1.3.1
  • golang version: 1.13
@ZergsLaw
Copy link
Contributor Author

If necessary, it would be my great pleasure to send PR

@cvgw cvgw added the type: bug label Dec 27, 2019
@cvgw
Copy link
Collaborator

cvgw commented Dec 27, 2019

Thanks for the bug report @ZergsLaw. Feel free it submit a PR if you'd like, otherwise we will addresses this as soon as possible.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants