You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
Actual behavior A clear and concise description of what the bug is.
The three following functions are generated
// MockFinder is a mock of Finder interface.typeMockFinder[T notifier.Clonable[notifier.T]] struct {
ctrl*gomock.Controllerrecorder*MockFinderMockRecorder[T]
}
// MockFinderMockRecorder is the mock recorder for MockFinder.typeMockFinderMockRecorder[T notifier.Clonable[notifier.T]] struct {
mock*MockFinder[T]
}
// NewMockFinder creates a new mock instance.funcNewMockFinder[T notifier.Clonable[notifier.T]](ctrl*gomock.Controller) *MockFinder[T] {
mock:=&MockFinder[T]{ctrl: ctrl}
mock.recorder=&MockFinderMockRecorder[T]{mock}
returnmock
}
Note that in the above the generic type T is treated as an exported type from notifier
Expected behavior A clear and concise description of what you expected to
happen.
notifier.Clonable[notifier.T] should be notifier.Clonable[T] in the function signatures
// MockFinder is a mock of Finder interface.typeMockFinder[T notifier.Clonable[T]] struct {
/* ... */
}
// MockFinderMockRecorder is the mock recorder for MockFinder.typeMockFinderMockRecorder[T notifier.Clonable[T]] struct {
/* ... */
}
// NewMockFinder creates a new mock instance.funcNewMockFinder[T notifier.Clonable[T]](ctrl*gomock.Controller) *MockFinder[T] {
/* ... */
}
the nested T in [T notifier.Clonable[T]] is parsed into ast.NamedType in mockgen/generic_go118.go and Name() on NamedType always prefixes the NamedType with the package the NamedType is declared in.
Not very familiar with the codebase, but I would assume that to support nested generic interfaces, we would need to introduce another TypeParam implementation, e.g, something along the lines of PlaceholderType or GenericType. Let me know what you think, I'd be happy to work on this
Consider a source file
notifier.go
we want to mock, with the following pattern :Actual behavior A clear and concise description of what the bug is.
The three following functions are generated
Note that in the above the generic type T is treated as an exported type from notifier
Expected behavior A clear and concise description of what you expected to
happen.
notifier.Clonable[notifier.T]
should benotifier.Clonable[T]
in the function signaturesTo Reproduce Steps to reproduce the behavior
Additional Information
github.com/golang/mock v1.6.1-0.20220512030613-73266f9366fc
Triage Notes for the Maintainers
Seems like a fun one
The text was updated successfully, but these errors were encountered: