diff --git a/gomock/example_test.go b/gomock/example_test.go index 994ec43..6051b71 100644 --- a/gomock/example_test.go +++ b/gomock/example_test.go @@ -12,6 +12,7 @@ import ( type Foo interface { Bar(string) string + String() string } func ExampleCall_DoAndReturn_latency() { diff --git a/gomock/internal/mock_gomock/mock_matcher.go b/gomock/internal/mock_gomock/mock_matcher.go index bf3cc1e..fb0693c 100644 --- a/gomock/internal/mock_gomock/mock_matcher.go +++ b/gomock/internal/mock_gomock/mock_matcher.go @@ -38,6 +38,11 @@ func (m *MockMatcher) EXPECT() *MockMatcherMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockMatcher) ISGOMOCK() struct{} { + return struct{}{} +} + // Matches mocks base method. func (m *MockMatcher) Matches(arg0 any) bool { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/add_generate_directive/mock.go b/mockgen/internal/tests/add_generate_directive/mock.go index 9c9098d..1594548 100644 --- a/mockgen/internal/tests/add_generate_directive/mock.go +++ b/mockgen/internal/tests/add_generate_directive/mock.go @@ -40,6 +40,11 @@ func (m *MockFoo) EXPECT() *MockFooMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockFoo) ISGOMOCK() struct{} { + return struct{}{} +} + // Bar mocks base method. func (m *MockFoo) Bar(arg0 []string, arg1 chan<- Message) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/const_array_length/mock.go b/mockgen/internal/tests/const_array_length/mock.go index bd71ca9..844a9ab 100644 --- a/mockgen/internal/tests/const_array_length/mock.go +++ b/mockgen/internal/tests/const_array_length/mock.go @@ -38,6 +38,11 @@ func (m *MockI) EXPECT() *MockIMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockI) ISGOMOCK() struct{} { + return struct{}{} +} + // Bar mocks base method. func (m *MockI) Bar() [2]int { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/copyright_file/mock.go b/mockgen/internal/tests/copyright_file/mock.go index 65fd79c..cd71bea 100644 --- a/mockgen/internal/tests/copyright_file/mock.go +++ b/mockgen/internal/tests/copyright_file/mock.go @@ -42,3 +42,8 @@ func NewMockEmpty(ctrl *gomock.Controller) *MockEmpty { func (m *MockEmpty) EXPECT() *MockEmptyMockRecorder { return m.recorder } + +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockEmpty) ISGOMOCK() struct{} { + return struct{}{} +} diff --git a/mockgen/internal/tests/custom_package_name/greeter/greeter_mock_test.go b/mockgen/internal/tests/custom_package_name/greeter/greeter_mock_test.go index e54593b..1eaa93c 100644 --- a/mockgen/internal/tests/custom_package_name/greeter/greeter_mock_test.go +++ b/mockgen/internal/tests/custom_package_name/greeter/greeter_mock_test.go @@ -39,6 +39,11 @@ func (m *MockInputMaker) EXPECT() *MockInputMakerMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockInputMaker) ISGOMOCK() struct{} { + return struct{}{} +} + // MakeInput mocks base method. func (m *MockInputMaker) MakeInput() client.GreetInput { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/defined_import_local_name/mock.go b/mockgen/internal/tests/defined_import_local_name/mock.go index ca9577a..9648c8f 100644 --- a/mockgen/internal/tests/defined_import_local_name/mock.go +++ b/mockgen/internal/tests/defined_import_local_name/mock.go @@ -40,6 +40,11 @@ func (m *MockWithImports) EXPECT() *MockWithImportsMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockWithImports) ISGOMOCK() struct{} { + return struct{}{} +} + // Method1 mocks base method. func (m *MockWithImports) Method1() b_mock.Buffer { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/dot_imports/mock.go b/mockgen/internal/tests/dot_imports/mock.go index 4e9f67e..20d27d3 100644 --- a/mockgen/internal/tests/dot_imports/mock.go +++ b/mockgen/internal/tests/dot_imports/mock.go @@ -41,6 +41,11 @@ func (m *MockWithDotImports) EXPECT() *MockWithDotImportsMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockWithDotImports) ISGOMOCK() struct{} { + return struct{}{} +} + // Method1 mocks base method. func (m *MockWithDotImports) Method1() Request { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/empty_interface/mock.go b/mockgen/internal/tests/empty_interface/mock.go index b19c4b2..6656e40 100644 --- a/mockgen/internal/tests/empty_interface/mock.go +++ b/mockgen/internal/tests/empty_interface/mock.go @@ -35,3 +35,8 @@ func NewMockEmpty(ctrl *gomock.Controller) *MockEmpty { func (m *MockEmpty) EXPECT() *MockEmptyMockRecorder { return m.recorder } + +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockEmpty) ISGOMOCK() struct{} { + return struct{}{} +} diff --git a/mockgen/internal/tests/exclude/mock.go b/mockgen/internal/tests/exclude/mock.go index f13a92a..4f219ae 100644 --- a/mockgen/internal/tests/exclude/mock.go +++ b/mockgen/internal/tests/exclude/mock.go @@ -38,6 +38,11 @@ func (m *MockGenerateMockForMe) EXPECT() *MockGenerateMockForMeMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockGenerateMockForMe) ISGOMOCK() struct{} { + return struct{}{} +} + // B mocks base method. func (m *MockGenerateMockForMe) B() int { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/extra_import/mock.go b/mockgen/internal/tests/extra_import/mock.go index b730cd3..1c3173c 100644 --- a/mockgen/internal/tests/extra_import/mock.go +++ b/mockgen/internal/tests/extra_import/mock.go @@ -38,6 +38,11 @@ func (m *MockFoo) EXPECT() *MockFooMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockFoo) ISGOMOCK() struct{} { + return struct{}{} +} + // Bar mocks base method. func (m *MockFoo) Bar(arg0 []string, arg1 chan<- Message) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/generated_identifier_conflict/bugreport_mock.go b/mockgen/internal/tests/generated_identifier_conflict/bugreport_mock.go index c66a763..cf871e1 100644 --- a/mockgen/internal/tests/generated_identifier_conflict/bugreport_mock.go +++ b/mockgen/internal/tests/generated_identifier_conflict/bugreport_mock.go @@ -38,6 +38,11 @@ func (m *MockExample) EXPECT() *MockExampleMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockExample) ISGOMOCK() struct{} { + return struct{}{} +} + // Method mocks base method. func (m_2 *MockExample) Method(_m, _mr, m, mr int) { m_2.ctrl.T.Helper() diff --git a/mockgen/internal/tests/generics/source/mock_external_mock.go b/mockgen/internal/tests/generics/source/mock_external_mock.go index 7e3700f..20df447 100644 --- a/mockgen/internal/tests/generics/source/mock_external_mock.go +++ b/mockgen/internal/tests/generics/source/mock_external_mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: external.go +// +// Generated by this command: +// +// mockgen --source=external.go --destination=source/mock_external_mock.go --package source +// // Package source is a generated GoMock package. package source @@ -37,6 +42,11 @@ func (m *MockExternalConstraint[I, F]) EXPECT() *MockExternalConstraintMockRecor return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockExternalConstraint[I, F]) ISGOMOCK() struct{} { + return struct{}{} +} + // Eight mocks base method. func (m *MockExternalConstraint[I, F]) Eight(arg0 F) other.Two[I, F] { m.ctrl.T.Helper() @@ -242,6 +252,11 @@ func (m *MockEmbeddingIface[T, R]) EXPECT() *MockEmbeddingIfaceMockRecorder[T, R return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockEmbeddingIface[T, R]) ISGOMOCK() struct{} { + return struct{}{} +} + // Eight mocks base method. func (m *MockEmbeddingIface[T, R]) Eight(arg0 R) other.Two[T, R] { m.ctrl.T.Helper() @@ -546,6 +561,11 @@ func (m *MockGenerator[T]) EXPECT() *MockGeneratorMockRecorder[T] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockGenerator[T]) ISGOMOCK() struct{} { + return struct{}{} +} + // Generate mocks base method. func (m *MockGenerator[T]) Generate() T { m.ctrl.T.Helper() @@ -583,6 +603,11 @@ func (m *MockGroup[T]) EXPECT() *MockGroupMockRecorder[T] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockGroup[T]) ISGOMOCK() struct{} { + return struct{}{} +} + // Join mocks base method. func (m *MockGroup[T]) Join(ctx context.Context) []T { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/generics/source/mock_generics_mock.go b/mockgen/internal/tests/generics/source/mock_generics_mock.go index 8953118..39c331b 100644 --- a/mockgen/internal/tests/generics/source/mock_generics_mock.go +++ b/mockgen/internal/tests/generics/source/mock_generics_mock.go @@ -41,6 +41,11 @@ func (m *MockBar[T, R]) EXPECT() *MockBarMockRecorder[T, R] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockBar[T, R]) ISGOMOCK() struct{} { + return struct{}{} +} + // Eight mocks base method. func (m *MockBar[T, R]) Eight(arg0 T) other.Two[T, R] { m.ctrl.T.Helper() @@ -334,6 +339,11 @@ func (m *MockUniverse[T]) EXPECT() *MockUniverseMockRecorder[T] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockUniverse[T]) ISGOMOCK() struct{} { + return struct{}{} +} + // Water mocks base method. func (m *MockUniverse[T]) Water(arg0 T) []T { m.ctrl.T.Helper() @@ -371,6 +381,11 @@ func (m *MockMilkyWay[R]) EXPECT() *MockMilkyWayMockRecorder[R] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockMilkyWay[R]) ISGOMOCK() struct{} { + return struct{}{} +} + // Water mocks base method. func (m *MockMilkyWay[R]) Water(arg0 R) []R { m.ctrl.T.Helper() @@ -408,6 +423,11 @@ func (m *MockSolarSystem[T]) EXPECT() *MockSolarSystemMockRecorder[T] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockSolarSystem[T]) ISGOMOCK() struct{} { + return struct{}{} +} + // Water mocks base method. func (m *MockSolarSystem[T]) Water(arg0 T) []T { m.ctrl.T.Helper() @@ -445,6 +465,11 @@ func (m *MockEarth[R]) EXPECT() *MockEarthMockRecorder[R] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockEarth[R]) ISGOMOCK() struct{} { + return struct{}{} +} + // Water mocks base method. func (m *MockEarth[R]) Water(arg0 R) []R { m.ctrl.T.Helper() @@ -482,6 +507,11 @@ func (m *MockWater[R, C]) EXPECT() *MockWaterMockRecorder[R, C] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockWater[R, C]) ISGOMOCK() struct{} { + return struct{}{} +} + // Fish mocks base method. func (m *MockWater[R, C]) Fish(arg0 R) []C { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go b/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go index f0b9d84..5564c86 100644 --- a/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go +++ b/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go @@ -40,6 +40,11 @@ func (m *MockSource) EXPECT() *MockSourceMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockSource) ISGOMOCK() struct{} { + return struct{}{} +} + // Bar mocks base method. func (m *MockSource) Bar() Baz { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/import_embedded_interface/net_mock.go b/mockgen/internal/tests/import_embedded_interface/net_mock.go index 8831f62..1f7ba06 100644 --- a/mockgen/internal/tests/import_embedded_interface/net_mock.go +++ b/mockgen/internal/tests/import_embedded_interface/net_mock.go @@ -39,6 +39,11 @@ func (m *MockNet) EXPECT() *MockNetMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockNet) ISGOMOCK() struct{} { + return struct{}{} +} + // Header mocks base method. func (m *MockNet) Header() http.Header { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/import_source/definition/source_mock.go b/mockgen/internal/tests/import_source/definition/source_mock.go index 783c5a5..318544a 100644 --- a/mockgen/internal/tests/import_source/definition/source_mock.go +++ b/mockgen/internal/tests/import_source/definition/source_mock.go @@ -38,6 +38,11 @@ func (m *MockS) EXPECT() *MockSMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockS) ISGOMOCK() struct{} { + return struct{}{} +} + // F mocks base method. func (m *MockS) F(arg0 X) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/import_source/source_mock.go b/mockgen/internal/tests/import_source/source_mock.go index 740dcfa..7605f4a 100644 --- a/mockgen/internal/tests/import_source/source_mock.go +++ b/mockgen/internal/tests/import_source/source_mock.go @@ -39,6 +39,11 @@ func (m *MockS) EXPECT() *MockSMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockS) ISGOMOCK() struct{} { + return struct{}{} +} + // F mocks base method. func (m *MockS) F(arg0 source.X) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/mock.go b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/mock.go index 016f1e2..0f841bf 100644 --- a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/mock.go +++ b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/mock.go @@ -39,6 +39,11 @@ func (m *MockArg) EXPECT() *MockArgMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockArg) ISGOMOCK() struct{} { + return struct{}{} +} + // Foo mocks base method. func (m *MockArg) Foo() int { m.ctrl.T.Helper() @@ -76,6 +81,11 @@ func (m *MockIntf) EXPECT() *MockIntfMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockIntf) ISGOMOCK() struct{} { + return struct{}{} +} + // F mocks base method. func (m *MockIntf) F() pkg.Arg { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/missing_import/output/source_mock.go b/mockgen/internal/tests/missing_import/output/source_mock.go index 4fb6542..7f20a99 100644 --- a/mockgen/internal/tests/missing_import/output/source_mock.go +++ b/mockgen/internal/tests/missing_import/output/source_mock.go @@ -39,6 +39,11 @@ func (m *MockBar) EXPECT() *MockBarMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockBar) ISGOMOCK() struct{} { + return struct{}{} +} + // Baz mocks base method. func (m *MockBar) Baz(arg0 source.Foo) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/mock_in_test_package/mock_test.go b/mockgen/internal/tests/mock_in_test_package/mock_test.go index be55b03..6b187d8 100644 --- a/mockgen/internal/tests/mock_in_test_package/mock_test.go +++ b/mockgen/internal/tests/mock_in_test_package/mock_test.go @@ -39,6 +39,11 @@ func (m *MockFinder) EXPECT() *MockFinderMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockFinder) ISGOMOCK() struct{} { + return struct{}{} +} + // Add mocks base method. func (m *MockFinder) Add(u users.User) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/mock_name/mocks/post_service.go b/mockgen/internal/tests/mock_name/mocks/post_service.go index dc49918..d1dcc6d 100644 --- a/mockgen/internal/tests/mock_name/mocks/post_service.go +++ b/mockgen/internal/tests/mock_name/mocks/post_service.go @@ -40,6 +40,11 @@ func (m *PostServiceMock) EXPECT() *PostServiceMockMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *PostServiceMock) ISGOMOCK() struct{} { + return struct{}{} +} + // Create mocks base method. func (m *PostServiceMock) Create(arg0, arg1 string, arg2 *user.User) (*post.Post, error) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/mock_name/mocks/user_service.go b/mockgen/internal/tests/mock_name/mocks/user_service.go index db5b35e..8842eae 100644 --- a/mockgen/internal/tests/mock_name/mocks/user_service.go +++ b/mockgen/internal/tests/mock_name/mocks/user_service.go @@ -39,6 +39,11 @@ func (m *UserServiceMock) EXPECT() *UserServiceMockMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *UserServiceMock) ISGOMOCK() struct{} { + return struct{}{} +} + // Create mocks base method. func (m *UserServiceMock) Create(arg0 string) (*user.User, error) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/overlapping_methods/mock.go b/mockgen/internal/tests/overlapping_methods/mock.go index 139c15e..2cd0751 100644 --- a/mockgen/internal/tests/overlapping_methods/mock.go +++ b/mockgen/internal/tests/overlapping_methods/mock.go @@ -38,6 +38,11 @@ func (m *MockReadWriteCloser) EXPECT() *MockReadWriteCloserMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockReadWriteCloser) ISGOMOCK() struct{} { + return struct{}{} +} + // Close mocks base method. func (m *MockReadWriteCloser) Close() error { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/panicing_test/mock_test.go b/mockgen/internal/tests/panicing_test/mock_test.go index ebdbd72..42e5fae 100644 --- a/mockgen/internal/tests/panicing_test/mock_test.go +++ b/mockgen/internal/tests/panicing_test/mock_test.go @@ -38,6 +38,11 @@ func (m *MockFoo) EXPECT() *MockFooMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockFoo) ISGOMOCK() struct{} { + return struct{}{} +} + // Bar mocks base method. func (m *MockFoo) Bar() string { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/sanitization/mockout/mock.go b/mockgen/internal/tests/sanitization/mockout/mock.go index a529b2d..8e130b9 100644 --- a/mockgen/internal/tests/sanitization/mockout/mock.go +++ b/mockgen/internal/tests/sanitization/mockout/mock.go @@ -39,6 +39,11 @@ func (m *MockAnyMock) EXPECT() *MockAnyMockMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockAnyMock) ISGOMOCK() struct{} { + return struct{}{} +} + // Do mocks base method. func (m *MockAnyMock) Do(arg0 *any0.Any, arg1 int) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/self_package/mock.go b/mockgen/internal/tests/self_package/mock.go index dc322b0..18494fa 100644 --- a/mockgen/internal/tests/self_package/mock.go +++ b/mockgen/internal/tests/self_package/mock.go @@ -38,6 +38,11 @@ func (m *MockMethods) EXPECT() *MockMethodsMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockMethods) ISGOMOCK() struct{} { + return struct{}{} +} + // getInfo mocks base method. func (m *MockMethods) getInfo() Info { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/test_package/mock_test.go b/mockgen/internal/tests/test_package/mock_test.go index 364f94d..e0a5a0d 100644 --- a/mockgen/internal/tests/test_package/mock_test.go +++ b/mockgen/internal/tests/test_package/mock_test.go @@ -38,6 +38,11 @@ func (m *MockFinder) EXPECT() *MockFinderMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockFinder) ISGOMOCK() struct{} { + return struct{}{} +} + // Add mocks base method. func (m *MockFinder) Add(u User) { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/typed/bugreport_mock.go b/mockgen/internal/tests/typed/bugreport_mock.go index 3eba52a..00589b1 100644 --- a/mockgen/internal/tests/typed/bugreport_mock.go +++ b/mockgen/internal/tests/typed/bugreport_mock.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: bugreport.go +// +// Generated by this command: +// +// mockgen -typed -aux_files faux=faux/faux.go -destination bugreport_mock.go -package typed -source=bugreport.go Example +// // Package typed is a generated GoMock package. package typed @@ -34,6 +39,11 @@ func (m *MockSource) EXPECT() *MockSourceMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockSource) ISGOMOCK() struct{} { + return struct{}{} +} + // Error mocks base method. func (m *MockSource) Error() string { m.ctrl.T.Helper() @@ -43,31 +53,31 @@ func (m *MockSource) Error() string { } // Error indicates an expected call of Error. -func (mr *MockSourceMockRecorder) Error() *SourceErrorCall { +func (mr *MockSourceMockRecorder) Error() *MockSourceErrorCall { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Error", reflect.TypeOf((*MockSource)(nil).Error)) - return &SourceErrorCall{Call: call} + return &MockSourceErrorCall{Call: call} } -// SourceErrorCall wrap *gomock.Call -type SourceErrorCall struct { +// MockSourceErrorCall wrap *gomock.Call +type MockSourceErrorCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *SourceErrorCall) Return(arg0 string) *SourceErrorCall { +func (c *MockSourceErrorCall) Return(arg0 string) *MockSourceErrorCall { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *SourceErrorCall) Do(f func() string) *SourceErrorCall { +func (c *MockSourceErrorCall) Do(f func() string) *MockSourceErrorCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *SourceErrorCall) DoAndReturn(f func() string) *SourceErrorCall { +func (c *MockSourceErrorCall) DoAndReturn(f func() string) *MockSourceErrorCall { c.Call = c.Call.DoAndReturn(f) return c } @@ -81,31 +91,31 @@ func (m *MockSource) Method() faux.Return { } // Method indicates an expected call of Method. -func (mr *MockSourceMockRecorder) Method() *SourceMethodCall { +func (mr *MockSourceMockRecorder) Method() *MockSourceMethodCall { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Method", reflect.TypeOf((*MockSource)(nil).Method)) - return &SourceMethodCall{Call: call} + return &MockSourceMethodCall{Call: call} } -// SourceMethodCall wrap *gomock.Call -type SourceMethodCall struct { +// MockSourceMethodCall wrap *gomock.Call +type MockSourceMethodCall struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *SourceMethodCall) Return(arg0 faux.Return) *SourceMethodCall { +func (c *MockSourceMethodCall) Return(arg0 faux.Return) *MockSourceMethodCall { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *SourceMethodCall) Do(f func() faux.Return) *SourceMethodCall { +func (c *MockSourceMethodCall) Do(f func() faux.Return) *MockSourceMethodCall { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *SourceMethodCall) DoAndReturn(f func() faux.Return) *SourceMethodCall { +func (c *MockSourceMethodCall) DoAndReturn(f func() faux.Return) *MockSourceMethodCall { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/mockgen/internal/tests/typed/faux/faux.go b/mockgen/internal/tests/typed/faux/faux.go index fdd9c5f..00f795e 100644 --- a/mockgen/internal/tests/typed/faux/faux.go +++ b/mockgen/internal/tests/typed/faux/faux.go @@ -6,6 +6,6 @@ type Foreign interface { error } -type Embedded any +type Embedded interface{} -type Return any +type Return interface{} diff --git a/mockgen/internal/tests/typed/source/mock_external_test.go b/mockgen/internal/tests/typed/source/mock_external_test.go index 0f92d35..f74c930 100644 --- a/mockgen/internal/tests/typed/source/mock_external_test.go +++ b/mockgen/internal/tests/typed/source/mock_external_test.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: external.go +// +// Generated by this command: +// +// mockgen --source=external.go --destination=source/mock_external_test.go --package source -typed +// // Package source is a generated GoMock package. package source @@ -36,6 +41,11 @@ func (m *MockExternalConstraint[I, F]) EXPECT() *MockExternalConstraintMockRecor return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockExternalConstraint[I, F]) ISGOMOCK() struct{} { + return struct{}{} +} + // Eight mocks base method. func (m *MockExternalConstraint[I, F]) Eight(arg0 F) other.Two[I, F] { m.ctrl.T.Helper() @@ -45,31 +55,31 @@ func (m *MockExternalConstraint[I, F]) Eight(arg0 F) other.Two[I, F] { } // Eight indicates an expected call of Eight. -func (mr *MockExternalConstraintMockRecorder[I, F]) Eight(arg0 any) *ExternalConstraintEightCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Eight(arg0 any) *MockExternalConstraintEightCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eight", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Eight), arg0) - return &ExternalConstraintEightCall[I, F]{Call: call} + return &MockExternalConstraintEightCall[I, F]{Call: call} } -// ExternalConstraintEightCall wrap *gomock.Call -type ExternalConstraintEightCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintEightCall wrap *gomock.Call +type MockExternalConstraintEightCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintEightCall[I, F]) Return(arg0 other.Two[I, F]) *ExternalConstraintEightCall[I, F] { +func (c *MockExternalConstraintEightCall[I, F]) Return(arg0 other.Two[I, F]) *MockExternalConstraintEightCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintEightCall[I, F]) Do(f func(F) other.Two[I, F]) *ExternalConstraintEightCall[I, F] { +func (c *MockExternalConstraintEightCall[I, F]) Do(f func(F) other.Two[I, F]) *MockExternalConstraintEightCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintEightCall[I, F]) DoAndReturn(f func(F) other.Two[I, F]) *ExternalConstraintEightCall[I, F] { +func (c *MockExternalConstraintEightCall[I, F]) DoAndReturn(f func(F) other.Two[I, F]) *MockExternalConstraintEightCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -83,31 +93,31 @@ func (m *MockExternalConstraint[I, F]) Five(arg0 I) typed.Baz[F] { } // Five indicates an expected call of Five. -func (mr *MockExternalConstraintMockRecorder[I, F]) Five(arg0 any) *ExternalConstraintFiveCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Five(arg0 any) *MockExternalConstraintFiveCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Five", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Five), arg0) - return &ExternalConstraintFiveCall[I, F]{Call: call} + return &MockExternalConstraintFiveCall[I, F]{Call: call} } -// ExternalConstraintFiveCall wrap *gomock.Call -type ExternalConstraintFiveCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintFiveCall wrap *gomock.Call +type MockExternalConstraintFiveCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintFiveCall[I, F]) Return(arg0 typed.Baz[F]) *ExternalConstraintFiveCall[I, F] { +func (c *MockExternalConstraintFiveCall[I, F]) Return(arg0 typed.Baz[F]) *MockExternalConstraintFiveCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintFiveCall[I, F]) Do(f func(I) typed.Baz[F]) *ExternalConstraintFiveCall[I, F] { +func (c *MockExternalConstraintFiveCall[I, F]) Do(f func(I) typed.Baz[F]) *MockExternalConstraintFiveCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintFiveCall[I, F]) DoAndReturn(f func(I) typed.Baz[F]) *ExternalConstraintFiveCall[I, F] { +func (c *MockExternalConstraintFiveCall[I, F]) DoAndReturn(f func(I) typed.Baz[F]) *MockExternalConstraintFiveCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -121,31 +131,31 @@ func (m *MockExternalConstraint[I, F]) Four(arg0 I) typed.Foo[I, F] { } // Four indicates an expected call of Four. -func (mr *MockExternalConstraintMockRecorder[I, F]) Four(arg0 any) *ExternalConstraintFourCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Four(arg0 any) *MockExternalConstraintFourCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Four", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Four), arg0) - return &ExternalConstraintFourCall[I, F]{Call: call} + return &MockExternalConstraintFourCall[I, F]{Call: call} } -// ExternalConstraintFourCall wrap *gomock.Call -type ExternalConstraintFourCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintFourCall wrap *gomock.Call +type MockExternalConstraintFourCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintFourCall[I, F]) Return(arg0 typed.Foo[I, F]) *ExternalConstraintFourCall[I, F] { +func (c *MockExternalConstraintFourCall[I, F]) Return(arg0 typed.Foo[I, F]) *MockExternalConstraintFourCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintFourCall[I, F]) Do(f func(I) typed.Foo[I, F]) *ExternalConstraintFourCall[I, F] { +func (c *MockExternalConstraintFourCall[I, F]) Do(f func(I) typed.Foo[I, F]) *MockExternalConstraintFourCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintFourCall[I, F]) DoAndReturn(f func(I) typed.Foo[I, F]) *ExternalConstraintFourCall[I, F] { +func (c *MockExternalConstraintFourCall[I, F]) DoAndReturn(f func(I) typed.Foo[I, F]) *MockExternalConstraintFourCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -157,31 +167,31 @@ func (m *MockExternalConstraint[I, F]) Nine(arg0 typed.Iface[I]) { } // Nine indicates an expected call of Nine. -func (mr *MockExternalConstraintMockRecorder[I, F]) Nine(arg0 any) *ExternalConstraintNineCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Nine(arg0 any) *MockExternalConstraintNineCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nine", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Nine), arg0) - return &ExternalConstraintNineCall[I, F]{Call: call} + return &MockExternalConstraintNineCall[I, F]{Call: call} } -// ExternalConstraintNineCall wrap *gomock.Call -type ExternalConstraintNineCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintNineCall wrap *gomock.Call +type MockExternalConstraintNineCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintNineCall[I, F]) Return() *ExternalConstraintNineCall[I, F] { +func (c *MockExternalConstraintNineCall[I, F]) Return() *MockExternalConstraintNineCall[I, F] { c.Call = c.Call.Return() return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintNineCall[I, F]) Do(f func(typed.Iface[I])) *ExternalConstraintNineCall[I, F] { +func (c *MockExternalConstraintNineCall[I, F]) Do(f func(typed.Iface[I])) *MockExternalConstraintNineCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintNineCall[I, F]) DoAndReturn(f func(typed.Iface[I])) *ExternalConstraintNineCall[I, F] { +func (c *MockExternalConstraintNineCall[I, F]) DoAndReturn(f func(typed.Iface[I])) *MockExternalConstraintNineCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -195,31 +205,31 @@ func (m *MockExternalConstraint[I, F]) One(arg0 string) string { } // One indicates an expected call of One. -func (mr *MockExternalConstraintMockRecorder[I, F]) One(arg0 any) *ExternalConstraintOneCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) One(arg0 any) *MockExternalConstraintOneCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "One", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).One), arg0) - return &ExternalConstraintOneCall[I, F]{Call: call} + return &MockExternalConstraintOneCall[I, F]{Call: call} } -// ExternalConstraintOneCall wrap *gomock.Call -type ExternalConstraintOneCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintOneCall wrap *gomock.Call +type MockExternalConstraintOneCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintOneCall[I, F]) Return(arg0 string) *ExternalConstraintOneCall[I, F] { +func (c *MockExternalConstraintOneCall[I, F]) Return(arg0 string) *MockExternalConstraintOneCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintOneCall[I, F]) Do(f func(string) string) *ExternalConstraintOneCall[I, F] { +func (c *MockExternalConstraintOneCall[I, F]) Do(f func(string) string) *MockExternalConstraintOneCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintOneCall[I, F]) DoAndReturn(f func(string) string) *ExternalConstraintOneCall[I, F] { +func (c *MockExternalConstraintOneCall[I, F]) DoAndReturn(f func(string) string) *MockExternalConstraintOneCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -233,31 +243,31 @@ func (m *MockExternalConstraint[I, F]) Seven(arg0 I) other.One[I] { } // Seven indicates an expected call of Seven. -func (mr *MockExternalConstraintMockRecorder[I, F]) Seven(arg0 any) *ExternalConstraintSevenCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Seven(arg0 any) *MockExternalConstraintSevenCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Seven", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Seven), arg0) - return &ExternalConstraintSevenCall[I, F]{Call: call} + return &MockExternalConstraintSevenCall[I, F]{Call: call} } -// ExternalConstraintSevenCall wrap *gomock.Call -type ExternalConstraintSevenCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintSevenCall wrap *gomock.Call +type MockExternalConstraintSevenCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintSevenCall[I, F]) Return(arg0 other.One[I]) *ExternalConstraintSevenCall[I, F] { +func (c *MockExternalConstraintSevenCall[I, F]) Return(arg0 other.One[I]) *MockExternalConstraintSevenCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintSevenCall[I, F]) Do(f func(I) other.One[I]) *ExternalConstraintSevenCall[I, F] { +func (c *MockExternalConstraintSevenCall[I, F]) Do(f func(I) other.One[I]) *MockExternalConstraintSevenCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintSevenCall[I, F]) DoAndReturn(f func(I) other.One[I]) *ExternalConstraintSevenCall[I, F] { +func (c *MockExternalConstraintSevenCall[I, F]) DoAndReturn(f func(I) other.One[I]) *MockExternalConstraintSevenCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -271,31 +281,31 @@ func (m *MockExternalConstraint[I, F]) Six(arg0 I) *typed.Baz[F] { } // Six indicates an expected call of Six. -func (mr *MockExternalConstraintMockRecorder[I, F]) Six(arg0 any) *ExternalConstraintSixCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Six(arg0 any) *MockExternalConstraintSixCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Six", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Six), arg0) - return &ExternalConstraintSixCall[I, F]{Call: call} + return &MockExternalConstraintSixCall[I, F]{Call: call} } -// ExternalConstraintSixCall wrap *gomock.Call -type ExternalConstraintSixCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintSixCall wrap *gomock.Call +type MockExternalConstraintSixCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintSixCall[I, F]) Return(arg0 *typed.Baz[F]) *ExternalConstraintSixCall[I, F] { +func (c *MockExternalConstraintSixCall[I, F]) Return(arg0 *typed.Baz[F]) *MockExternalConstraintSixCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintSixCall[I, F]) Do(f func(I) *typed.Baz[F]) *ExternalConstraintSixCall[I, F] { +func (c *MockExternalConstraintSixCall[I, F]) Do(f func(I) *typed.Baz[F]) *MockExternalConstraintSixCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintSixCall[I, F]) DoAndReturn(f func(I) *typed.Baz[F]) *ExternalConstraintSixCall[I, F] { +func (c *MockExternalConstraintSixCall[I, F]) DoAndReturn(f func(I) *typed.Baz[F]) *MockExternalConstraintSixCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -307,31 +317,31 @@ func (m *MockExternalConstraint[I, F]) Ten(arg0 *I) { } // Ten indicates an expected call of Ten. -func (mr *MockExternalConstraintMockRecorder[I, F]) Ten(arg0 any) *ExternalConstraintTenCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Ten(arg0 any) *MockExternalConstraintTenCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ten", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Ten), arg0) - return &ExternalConstraintTenCall[I, F]{Call: call} + return &MockExternalConstraintTenCall[I, F]{Call: call} } -// ExternalConstraintTenCall wrap *gomock.Call -type ExternalConstraintTenCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintTenCall wrap *gomock.Call +type MockExternalConstraintTenCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintTenCall[I, F]) Return() *ExternalConstraintTenCall[I, F] { +func (c *MockExternalConstraintTenCall[I, F]) Return() *MockExternalConstraintTenCall[I, F] { c.Call = c.Call.Return() return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintTenCall[I, F]) Do(f func(*I)) *ExternalConstraintTenCall[I, F] { +func (c *MockExternalConstraintTenCall[I, F]) Do(f func(*I)) *MockExternalConstraintTenCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintTenCall[I, F]) DoAndReturn(f func(*I)) *ExternalConstraintTenCall[I, F] { +func (c *MockExternalConstraintTenCall[I, F]) DoAndReturn(f func(*I)) *MockExternalConstraintTenCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -345,31 +355,31 @@ func (m *MockExternalConstraint[I, F]) Three(arg0 I) F { } // Three indicates an expected call of Three. -func (mr *MockExternalConstraintMockRecorder[I, F]) Three(arg0 any) *ExternalConstraintThreeCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Three(arg0 any) *MockExternalConstraintThreeCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Three", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Three), arg0) - return &ExternalConstraintThreeCall[I, F]{Call: call} + return &MockExternalConstraintThreeCall[I, F]{Call: call} } -// ExternalConstraintThreeCall wrap *gomock.Call -type ExternalConstraintThreeCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintThreeCall wrap *gomock.Call +type MockExternalConstraintThreeCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintThreeCall[I, F]) Return(arg0 F) *ExternalConstraintThreeCall[I, F] { +func (c *MockExternalConstraintThreeCall[I, F]) Return(arg0 F) *MockExternalConstraintThreeCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintThreeCall[I, F]) Do(f func(I) F) *ExternalConstraintThreeCall[I, F] { +func (c *MockExternalConstraintThreeCall[I, F]) Do(f func(I) F) *MockExternalConstraintThreeCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintThreeCall[I, F]) DoAndReturn(f func(I) F) *ExternalConstraintThreeCall[I, F] { +func (c *MockExternalConstraintThreeCall[I, F]) DoAndReturn(f func(I) F) *MockExternalConstraintThreeCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } @@ -383,31 +393,31 @@ func (m *MockExternalConstraint[I, F]) Two(arg0 I) string { } // Two indicates an expected call of Two. -func (mr *MockExternalConstraintMockRecorder[I, F]) Two(arg0 any) *ExternalConstraintTwoCall[I, F] { +func (mr *MockExternalConstraintMockRecorder[I, F]) Two(arg0 any) *MockExternalConstraintTwoCall[I, F] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Two", reflect.TypeOf((*MockExternalConstraint[I, F])(nil).Two), arg0) - return &ExternalConstraintTwoCall[I, F]{Call: call} + return &MockExternalConstraintTwoCall[I, F]{Call: call} } -// ExternalConstraintTwoCall wrap *gomock.Call -type ExternalConstraintTwoCall[I constraints.Integer, F constraints.Float] struct { +// MockExternalConstraintTwoCall wrap *gomock.Call +type MockExternalConstraintTwoCall[I constraints.Integer, F constraints.Float] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *ExternalConstraintTwoCall[I, F]) Return(arg0 string) *ExternalConstraintTwoCall[I, F] { +func (c *MockExternalConstraintTwoCall[I, F]) Return(arg0 string) *MockExternalConstraintTwoCall[I, F] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *ExternalConstraintTwoCall[I, F]) Do(f func(I) string) *ExternalConstraintTwoCall[I, F] { +func (c *MockExternalConstraintTwoCall[I, F]) Do(f func(I) string) *MockExternalConstraintTwoCall[I, F] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *ExternalConstraintTwoCall[I, F]) DoAndReturn(f func(I) string) *ExternalConstraintTwoCall[I, F] { +func (c *MockExternalConstraintTwoCall[I, F]) DoAndReturn(f func(I) string) *MockExternalConstraintTwoCall[I, F] { c.Call = c.Call.DoAndReturn(f) return c } diff --git a/mockgen/internal/tests/typed/source/mock_generics_test.go b/mockgen/internal/tests/typed/source/mock_generics_test.go index 5bfbccc..40352fe 100644 --- a/mockgen/internal/tests/typed/source/mock_generics_test.go +++ b/mockgen/internal/tests/typed/source/mock_generics_test.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: generics.go +// +// Generated by this command: +// +// mockgen --source=generics.go --destination=source/mock_generics_test.go --package source -typed +// // Package source is a generated GoMock package. package source @@ -35,6 +40,11 @@ func (m *MockBar[T, R]) EXPECT() *MockBarMockRecorder[T, R] { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockBar[T, R]) ISGOMOCK() struct{} { + return struct{}{} +} + // Eight mocks base method. func (m *MockBar[T, R]) Eight(arg0 T) other.Two[T, R] { m.ctrl.T.Helper() @@ -44,31 +54,31 @@ func (m *MockBar[T, R]) Eight(arg0 T) other.Two[T, R] { } // Eight indicates an expected call of Eight. -func (mr *MockBarMockRecorder[T, R]) Eight(arg0 any) *BarEightCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Eight(arg0 any) *MockBarEightCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eight", reflect.TypeOf((*MockBar[T, R])(nil).Eight), arg0) - return &BarEightCall[T, R]{Call: call} + return &MockBarEightCall[T, R]{Call: call} } -// BarEightCall wrap *gomock.Call -type BarEightCall[T any, R any] struct { +// MockBarEightCall wrap *gomock.Call +type MockBarEightCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarEightCall[T, R]) Return(arg0 other.Two[T, R]) *BarEightCall[T, R] { +func (c *MockBarEightCall[T, R]) Return(arg0 other.Two[T, R]) *MockBarEightCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarEightCall[T, R]) Do(f func(T) other.Two[T, R]) *BarEightCall[T, R] { +func (c *MockBarEightCall[T, R]) Do(f func(T) other.Two[T, R]) *MockBarEightCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarEightCall[T, R]) DoAndReturn(f func(T) other.Two[T, R]) *BarEightCall[T, R] { +func (c *MockBarEightCall[T, R]) DoAndReturn(f func(T) other.Two[T, R]) *MockBarEightCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -83,31 +93,31 @@ func (m *MockBar[T, R]) Eighteen() (typed.Iface[*other.Five], error) { } // Eighteen indicates an expected call of Eighteen. -func (mr *MockBarMockRecorder[T, R]) Eighteen() *BarEighteenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Eighteen() *MockBarEighteenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eighteen", reflect.TypeOf((*MockBar[T, R])(nil).Eighteen)) - return &BarEighteenCall[T, R]{Call: call} + return &MockBarEighteenCall[T, R]{Call: call} } -// BarEighteenCall wrap *gomock.Call -type BarEighteenCall[T any, R any] struct { +// MockBarEighteenCall wrap *gomock.Call +type MockBarEighteenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarEighteenCall[T, R]) Return(arg0 typed.Iface[*other.Five], arg1 error) *BarEighteenCall[T, R] { +func (c *MockBarEighteenCall[T, R]) Return(arg0 typed.Iface[*other.Five], arg1 error) *MockBarEighteenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarEighteenCall[T, R]) Do(f func() (typed.Iface[*other.Five], error)) *BarEighteenCall[T, R] { +func (c *MockBarEighteenCall[T, R]) Do(f func() (typed.Iface[*other.Five], error)) *MockBarEighteenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarEighteenCall[T, R]) DoAndReturn(f func() (typed.Iface[*other.Five], error)) *BarEighteenCall[T, R] { +func (c *MockBarEighteenCall[T, R]) DoAndReturn(f func() (typed.Iface[*other.Five], error)) *MockBarEighteenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -122,31 +132,31 @@ func (m *MockBar[T, R]) Eleven() (*other.One[T], error) { } // Eleven indicates an expected call of Eleven. -func (mr *MockBarMockRecorder[T, R]) Eleven() *BarElevenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Eleven() *MockBarElevenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eleven", reflect.TypeOf((*MockBar[T, R])(nil).Eleven)) - return &BarElevenCall[T, R]{Call: call} + return &MockBarElevenCall[T, R]{Call: call} } -// BarElevenCall wrap *gomock.Call -type BarElevenCall[T any, R any] struct { +// MockBarElevenCall wrap *gomock.Call +type MockBarElevenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarElevenCall[T, R]) Return(arg0 *other.One[T], arg1 error) *BarElevenCall[T, R] { +func (c *MockBarElevenCall[T, R]) Return(arg0 *other.One[T], arg1 error) *MockBarElevenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarElevenCall[T, R]) Do(f func() (*other.One[T], error)) *BarElevenCall[T, R] { +func (c *MockBarElevenCall[T, R]) Do(f func() (*other.One[T], error)) *MockBarElevenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarElevenCall[T, R]) DoAndReturn(f func() (*other.One[T], error)) *BarElevenCall[T, R] { +func (c *MockBarElevenCall[T, R]) DoAndReturn(f func() (*other.One[T], error)) *MockBarElevenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -161,31 +171,31 @@ func (m *MockBar[T, R]) Fifteen() (typed.Iface[typed.StructType], error) { } // Fifteen indicates an expected call of Fifteen. -func (mr *MockBarMockRecorder[T, R]) Fifteen() *BarFifteenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Fifteen() *MockBarFifteenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Fifteen", reflect.TypeOf((*MockBar[T, R])(nil).Fifteen)) - return &BarFifteenCall[T, R]{Call: call} + return &MockBarFifteenCall[T, R]{Call: call} } -// BarFifteenCall wrap *gomock.Call -type BarFifteenCall[T any, R any] struct { +// MockBarFifteenCall wrap *gomock.Call +type MockBarFifteenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarFifteenCall[T, R]) Return(arg0 typed.Iface[typed.StructType], arg1 error) *BarFifteenCall[T, R] { +func (c *MockBarFifteenCall[T, R]) Return(arg0 typed.Iface[typed.StructType], arg1 error) *MockBarFifteenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarFifteenCall[T, R]) Do(f func() (typed.Iface[typed.StructType], error)) *BarFifteenCall[T, R] { +func (c *MockBarFifteenCall[T, R]) Do(f func() (typed.Iface[typed.StructType], error)) *MockBarFifteenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarFifteenCall[T, R]) DoAndReturn(f func() (typed.Iface[typed.StructType], error)) *BarFifteenCall[T, R] { +func (c *MockBarFifteenCall[T, R]) DoAndReturn(f func() (typed.Iface[typed.StructType], error)) *MockBarFifteenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -199,31 +209,31 @@ func (m *MockBar[T, R]) Five(arg0 T) typed.Baz[T] { } // Five indicates an expected call of Five. -func (mr *MockBarMockRecorder[T, R]) Five(arg0 any) *BarFiveCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Five(arg0 any) *MockBarFiveCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Five", reflect.TypeOf((*MockBar[T, R])(nil).Five), arg0) - return &BarFiveCall[T, R]{Call: call} + return &MockBarFiveCall[T, R]{Call: call} } -// BarFiveCall wrap *gomock.Call -type BarFiveCall[T any, R any] struct { +// MockBarFiveCall wrap *gomock.Call +type MockBarFiveCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarFiveCall[T, R]) Return(arg0 typed.Baz[T]) *BarFiveCall[T, R] { +func (c *MockBarFiveCall[T, R]) Return(arg0 typed.Baz[T]) *MockBarFiveCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarFiveCall[T, R]) Do(f func(T) typed.Baz[T]) *BarFiveCall[T, R] { +func (c *MockBarFiveCall[T, R]) Do(f func(T) typed.Baz[T]) *MockBarFiveCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarFiveCall[T, R]) DoAndReturn(f func(T) typed.Baz[T]) *BarFiveCall[T, R] { +func (c *MockBarFiveCall[T, R]) DoAndReturn(f func(T) typed.Baz[T]) *MockBarFiveCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -237,31 +247,31 @@ func (m *MockBar[T, R]) Four(arg0 T) typed.Foo[T, R] { } // Four indicates an expected call of Four. -func (mr *MockBarMockRecorder[T, R]) Four(arg0 any) *BarFourCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Four(arg0 any) *MockBarFourCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Four", reflect.TypeOf((*MockBar[T, R])(nil).Four), arg0) - return &BarFourCall[T, R]{Call: call} + return &MockBarFourCall[T, R]{Call: call} } -// BarFourCall wrap *gomock.Call -type BarFourCall[T any, R any] struct { +// MockBarFourCall wrap *gomock.Call +type MockBarFourCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarFourCall[T, R]) Return(arg0 typed.Foo[T, R]) *BarFourCall[T, R] { +func (c *MockBarFourCall[T, R]) Return(arg0 typed.Foo[T, R]) *MockBarFourCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarFourCall[T, R]) Do(f func(T) typed.Foo[T, R]) *BarFourCall[T, R] { +func (c *MockBarFourCall[T, R]) Do(f func(T) typed.Foo[T, R]) *MockBarFourCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarFourCall[T, R]) DoAndReturn(f func(T) typed.Foo[T, R]) *BarFourCall[T, R] { +func (c *MockBarFourCall[T, R]) DoAndReturn(f func(T) typed.Foo[T, R]) *MockBarFourCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -276,31 +286,31 @@ func (m *MockBar[T, R]) Fourteen() (*typed.Foo[typed.StructType, typed.StructTyp } // Fourteen indicates an expected call of Fourteen. -func (mr *MockBarMockRecorder[T, R]) Fourteen() *BarFourteenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Fourteen() *MockBarFourteenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Fourteen", reflect.TypeOf((*MockBar[T, R])(nil).Fourteen)) - return &BarFourteenCall[T, R]{Call: call} + return &MockBarFourteenCall[T, R]{Call: call} } -// BarFourteenCall wrap *gomock.Call -type BarFourteenCall[T any, R any] struct { +// MockBarFourteenCall wrap *gomock.Call +type MockBarFourteenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarFourteenCall[T, R]) Return(arg0 *typed.Foo[typed.StructType, typed.StructType2], arg1 error) *BarFourteenCall[T, R] { +func (c *MockBarFourteenCall[T, R]) Return(arg0 *typed.Foo[typed.StructType, typed.StructType2], arg1 error) *MockBarFourteenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarFourteenCall[T, R]) Do(f func() (*typed.Foo[typed.StructType, typed.StructType2], error)) *BarFourteenCall[T, R] { +func (c *MockBarFourteenCall[T, R]) Do(f func() (*typed.Foo[typed.StructType, typed.StructType2], error)) *MockBarFourteenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarFourteenCall[T, R]) DoAndReturn(f func() (*typed.Foo[typed.StructType, typed.StructType2], error)) *BarFourteenCall[T, R] { +func (c *MockBarFourteenCall[T, R]) DoAndReturn(f func() (*typed.Foo[typed.StructType, typed.StructType2], error)) *MockBarFourteenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -312,31 +322,31 @@ func (m *MockBar[T, R]) Nine(arg0 typed.Iface[T]) { } // Nine indicates an expected call of Nine. -func (mr *MockBarMockRecorder[T, R]) Nine(arg0 any) *BarNineCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Nine(arg0 any) *MockBarNineCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nine", reflect.TypeOf((*MockBar[T, R])(nil).Nine), arg0) - return &BarNineCall[T, R]{Call: call} + return &MockBarNineCall[T, R]{Call: call} } -// BarNineCall wrap *gomock.Call -type BarNineCall[T any, R any] struct { +// MockBarNineCall wrap *gomock.Call +type MockBarNineCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarNineCall[T, R]) Return() *BarNineCall[T, R] { +func (c *MockBarNineCall[T, R]) Return() *MockBarNineCall[T, R] { c.Call = c.Call.Return() return c } // Do rewrite *gomock.Call.Do -func (c *BarNineCall[T, R]) Do(f func(typed.Iface[T])) *BarNineCall[T, R] { +func (c *MockBarNineCall[T, R]) Do(f func(typed.Iface[T])) *MockBarNineCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarNineCall[T, R]) DoAndReturn(f func(typed.Iface[T])) *BarNineCall[T, R] { +func (c *MockBarNineCall[T, R]) DoAndReturn(f func(typed.Iface[T])) *MockBarNineCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -350,31 +360,31 @@ func (m *MockBar[T, R]) Nineteen() typed.AliasType { } // Nineteen indicates an expected call of Nineteen. -func (mr *MockBarMockRecorder[T, R]) Nineteen() *BarNineteenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Nineteen() *MockBarNineteenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Nineteen", reflect.TypeOf((*MockBar[T, R])(nil).Nineteen)) - return &BarNineteenCall[T, R]{Call: call} + return &MockBarNineteenCall[T, R]{Call: call} } -// BarNineteenCall wrap *gomock.Call -type BarNineteenCall[T any, R any] struct { +// MockBarNineteenCall wrap *gomock.Call +type MockBarNineteenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarNineteenCall[T, R]) Return(arg0 typed.AliasType) *BarNineteenCall[T, R] { +func (c *MockBarNineteenCall[T, R]) Return(arg0 typed.AliasType) *MockBarNineteenCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarNineteenCall[T, R]) Do(f func() typed.AliasType) *BarNineteenCall[T, R] { +func (c *MockBarNineteenCall[T, R]) Do(f func() typed.AliasType) *MockBarNineteenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarNineteenCall[T, R]) DoAndReturn(f func() typed.AliasType) *BarNineteenCall[T, R] { +func (c *MockBarNineteenCall[T, R]) DoAndReturn(f func() typed.AliasType) *MockBarNineteenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -388,31 +398,31 @@ func (m *MockBar[T, R]) One(arg0 string) string { } // One indicates an expected call of One. -func (mr *MockBarMockRecorder[T, R]) One(arg0 any) *BarOneCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) One(arg0 any) *MockBarOneCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "One", reflect.TypeOf((*MockBar[T, R])(nil).One), arg0) - return &BarOneCall[T, R]{Call: call} + return &MockBarOneCall[T, R]{Call: call} } -// BarOneCall wrap *gomock.Call -type BarOneCall[T any, R any] struct { +// MockBarOneCall wrap *gomock.Call +type MockBarOneCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarOneCall[T, R]) Return(arg0 string) *BarOneCall[T, R] { +func (c *MockBarOneCall[T, R]) Return(arg0 string) *MockBarOneCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarOneCall[T, R]) Do(f func(string) string) *BarOneCall[T, R] { +func (c *MockBarOneCall[T, R]) Do(f func(string) string) *MockBarOneCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarOneCall[T, R]) DoAndReturn(f func(string) string) *BarOneCall[T, R] { +func (c *MockBarOneCall[T, R]) DoAndReturn(f func(string) string) *MockBarOneCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -426,31 +436,31 @@ func (m *MockBar[T, R]) Seven(arg0 T) other.One[T] { } // Seven indicates an expected call of Seven. -func (mr *MockBarMockRecorder[T, R]) Seven(arg0 any) *BarSevenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Seven(arg0 any) *MockBarSevenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Seven", reflect.TypeOf((*MockBar[T, R])(nil).Seven), arg0) - return &BarSevenCall[T, R]{Call: call} + return &MockBarSevenCall[T, R]{Call: call} } -// BarSevenCall wrap *gomock.Call -type BarSevenCall[T any, R any] struct { +// MockBarSevenCall wrap *gomock.Call +type MockBarSevenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarSevenCall[T, R]) Return(arg0 other.One[T]) *BarSevenCall[T, R] { +func (c *MockBarSevenCall[T, R]) Return(arg0 other.One[T]) *MockBarSevenCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarSevenCall[T, R]) Do(f func(T) other.One[T]) *BarSevenCall[T, R] { +func (c *MockBarSevenCall[T, R]) Do(f func(T) other.One[T]) *MockBarSevenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarSevenCall[T, R]) DoAndReturn(f func(T) other.One[T]) *BarSevenCall[T, R] { +func (c *MockBarSevenCall[T, R]) DoAndReturn(f func(T) other.One[T]) *MockBarSevenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -465,31 +475,31 @@ func (m *MockBar[T, R]) Seventeen() (*typed.Foo[other.Three, other.Four], error) } // Seventeen indicates an expected call of Seventeen. -func (mr *MockBarMockRecorder[T, R]) Seventeen() *BarSeventeenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Seventeen() *MockBarSeventeenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Seventeen", reflect.TypeOf((*MockBar[T, R])(nil).Seventeen)) - return &BarSeventeenCall[T, R]{Call: call} + return &MockBarSeventeenCall[T, R]{Call: call} } -// BarSeventeenCall wrap *gomock.Call -type BarSeventeenCall[T any, R any] struct { +// MockBarSeventeenCall wrap *gomock.Call +type MockBarSeventeenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarSeventeenCall[T, R]) Return(arg0 *typed.Foo[other.Three, other.Four], arg1 error) *BarSeventeenCall[T, R] { +func (c *MockBarSeventeenCall[T, R]) Return(arg0 *typed.Foo[other.Three, other.Four], arg1 error) *MockBarSeventeenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarSeventeenCall[T, R]) Do(f func() (*typed.Foo[other.Three, other.Four], error)) *BarSeventeenCall[T, R] { +func (c *MockBarSeventeenCall[T, R]) Do(f func() (*typed.Foo[other.Three, other.Four], error)) *MockBarSeventeenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarSeventeenCall[T, R]) DoAndReturn(f func() (*typed.Foo[other.Three, other.Four], error)) *BarSeventeenCall[T, R] { +func (c *MockBarSeventeenCall[T, R]) DoAndReturn(f func() (*typed.Foo[other.Three, other.Four], error)) *MockBarSeventeenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -503,31 +513,31 @@ func (m *MockBar[T, R]) Six(arg0 T) *typed.Baz[T] { } // Six indicates an expected call of Six. -func (mr *MockBarMockRecorder[T, R]) Six(arg0 any) *BarSixCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Six(arg0 any) *MockBarSixCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Six", reflect.TypeOf((*MockBar[T, R])(nil).Six), arg0) - return &BarSixCall[T, R]{Call: call} + return &MockBarSixCall[T, R]{Call: call} } -// BarSixCall wrap *gomock.Call -type BarSixCall[T any, R any] struct { +// MockBarSixCall wrap *gomock.Call +type MockBarSixCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarSixCall[T, R]) Return(arg0 *typed.Baz[T]) *BarSixCall[T, R] { +func (c *MockBarSixCall[T, R]) Return(arg0 *typed.Baz[T]) *MockBarSixCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarSixCall[T, R]) Do(f func(T) *typed.Baz[T]) *BarSixCall[T, R] { +func (c *MockBarSixCall[T, R]) Do(f func(T) *typed.Baz[T]) *MockBarSixCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarSixCall[T, R]) DoAndReturn(f func(T) *typed.Baz[T]) *BarSixCall[T, R] { +func (c *MockBarSixCall[T, R]) DoAndReturn(f func(T) *typed.Baz[T]) *MockBarSixCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -542,31 +552,31 @@ func (m *MockBar[T, R]) Sixteen() (typed.Baz[other.Three], error) { } // Sixteen indicates an expected call of Sixteen. -func (mr *MockBarMockRecorder[T, R]) Sixteen() *BarSixteenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Sixteen() *MockBarSixteenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sixteen", reflect.TypeOf((*MockBar[T, R])(nil).Sixteen)) - return &BarSixteenCall[T, R]{Call: call} + return &MockBarSixteenCall[T, R]{Call: call} } -// BarSixteenCall wrap *gomock.Call -type BarSixteenCall[T any, R any] struct { +// MockBarSixteenCall wrap *gomock.Call +type MockBarSixteenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarSixteenCall[T, R]) Return(arg0 typed.Baz[other.Three], arg1 error) *BarSixteenCall[T, R] { +func (c *MockBarSixteenCall[T, R]) Return(arg0 typed.Baz[other.Three], arg1 error) *MockBarSixteenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarSixteenCall[T, R]) Do(f func() (typed.Baz[other.Three], error)) *BarSixteenCall[T, R] { +func (c *MockBarSixteenCall[T, R]) Do(f func() (typed.Baz[other.Three], error)) *MockBarSixteenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarSixteenCall[T, R]) DoAndReturn(f func() (typed.Baz[other.Three], error)) *BarSixteenCall[T, R] { +func (c *MockBarSixteenCall[T, R]) DoAndReturn(f func() (typed.Baz[other.Three], error)) *MockBarSixteenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -578,31 +588,31 @@ func (m *MockBar[T, R]) Ten(arg0 *T) { } // Ten indicates an expected call of Ten. -func (mr *MockBarMockRecorder[T, R]) Ten(arg0 any) *BarTenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Ten(arg0 any) *MockBarTenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ten", reflect.TypeOf((*MockBar[T, R])(nil).Ten), arg0) - return &BarTenCall[T, R]{Call: call} + return &MockBarTenCall[T, R]{Call: call} } -// BarTenCall wrap *gomock.Call -type BarTenCall[T any, R any] struct { +// MockBarTenCall wrap *gomock.Call +type MockBarTenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarTenCall[T, R]) Return() *BarTenCall[T, R] { +func (c *MockBarTenCall[T, R]) Return() *MockBarTenCall[T, R] { c.Call = c.Call.Return() return c } // Do rewrite *gomock.Call.Do -func (c *BarTenCall[T, R]) Do(f func(*T)) *BarTenCall[T, R] { +func (c *MockBarTenCall[T, R]) Do(f func(*T)) *MockBarTenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarTenCall[T, R]) DoAndReturn(f func(*T)) *BarTenCall[T, R] { +func (c *MockBarTenCall[T, R]) DoAndReturn(f func(*T)) *MockBarTenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -617,31 +627,31 @@ func (m *MockBar[T, R]) Thirteen() (typed.Baz[typed.StructType], error) { } // Thirteen indicates an expected call of Thirteen. -func (mr *MockBarMockRecorder[T, R]) Thirteen() *BarThirteenCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Thirteen() *MockBarThirteenCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Thirteen", reflect.TypeOf((*MockBar[T, R])(nil).Thirteen)) - return &BarThirteenCall[T, R]{Call: call} + return &MockBarThirteenCall[T, R]{Call: call} } -// BarThirteenCall wrap *gomock.Call -type BarThirteenCall[T any, R any] struct { +// MockBarThirteenCall wrap *gomock.Call +type MockBarThirteenCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarThirteenCall[T, R]) Return(arg0 typed.Baz[typed.StructType], arg1 error) *BarThirteenCall[T, R] { +func (c *MockBarThirteenCall[T, R]) Return(arg0 typed.Baz[typed.StructType], arg1 error) *MockBarThirteenCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarThirteenCall[T, R]) Do(f func() (typed.Baz[typed.StructType], error)) *BarThirteenCall[T, R] { +func (c *MockBarThirteenCall[T, R]) Do(f func() (typed.Baz[typed.StructType], error)) *MockBarThirteenCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarThirteenCall[T, R]) DoAndReturn(f func() (typed.Baz[typed.StructType], error)) *BarThirteenCall[T, R] { +func (c *MockBarThirteenCall[T, R]) DoAndReturn(f func() (typed.Baz[typed.StructType], error)) *MockBarThirteenCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -655,31 +665,31 @@ func (m *MockBar[T, R]) Three(arg0 T) R { } // Three indicates an expected call of Three. -func (mr *MockBarMockRecorder[T, R]) Three(arg0 any) *BarThreeCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Three(arg0 any) *MockBarThreeCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Three", reflect.TypeOf((*MockBar[T, R])(nil).Three), arg0) - return &BarThreeCall[T, R]{Call: call} + return &MockBarThreeCall[T, R]{Call: call} } -// BarThreeCall wrap *gomock.Call -type BarThreeCall[T any, R any] struct { +// MockBarThreeCall wrap *gomock.Call +type MockBarThreeCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarThreeCall[T, R]) Return(arg0 R) *BarThreeCall[T, R] { +func (c *MockBarThreeCall[T, R]) Return(arg0 R) *MockBarThreeCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarThreeCall[T, R]) Do(f func(T) R) *BarThreeCall[T, R] { +func (c *MockBarThreeCall[T, R]) Do(f func(T) R) *MockBarThreeCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarThreeCall[T, R]) DoAndReturn(f func(T) R) *BarThreeCall[T, R] { +func (c *MockBarThreeCall[T, R]) DoAndReturn(f func(T) R) *MockBarThreeCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -694,31 +704,31 @@ func (m *MockBar[T, R]) Twelve() (*other.Two[T, R], error) { } // Twelve indicates an expected call of Twelve. -func (mr *MockBarMockRecorder[T, R]) Twelve() *BarTwelveCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Twelve() *MockBarTwelveCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Twelve", reflect.TypeOf((*MockBar[T, R])(nil).Twelve)) - return &BarTwelveCall[T, R]{Call: call} + return &MockBarTwelveCall[T, R]{Call: call} } -// BarTwelveCall wrap *gomock.Call -type BarTwelveCall[T any, R any] struct { +// MockBarTwelveCall wrap *gomock.Call +type MockBarTwelveCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarTwelveCall[T, R]) Return(arg0 *other.Two[T, R], arg1 error) *BarTwelveCall[T, R] { +func (c *MockBarTwelveCall[T, R]) Return(arg0 *other.Two[T, R], arg1 error) *MockBarTwelveCall[T, R] { c.Call = c.Call.Return(arg0, arg1) return c } // Do rewrite *gomock.Call.Do -func (c *BarTwelveCall[T, R]) Do(f func() (*other.Two[T, R], error)) *BarTwelveCall[T, R] { +func (c *MockBarTwelveCall[T, R]) Do(f func() (*other.Two[T, R], error)) *MockBarTwelveCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarTwelveCall[T, R]) DoAndReturn(f func() (*other.Two[T, R], error)) *BarTwelveCall[T, R] { +func (c *MockBarTwelveCall[T, R]) DoAndReturn(f func() (*other.Two[T, R], error)) *MockBarTwelveCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } @@ -732,54 +742,31 @@ func (m *MockBar[T, R]) Two(arg0 T) string { } // Two indicates an expected call of Two. -func (mr *MockBarMockRecorder[T, R]) Two(arg0 any) *BarTwoCall[T, R] { +func (mr *MockBarMockRecorder[T, R]) Two(arg0 any) *MockBarTwoCall[T, R] { mr.mock.ctrl.T.Helper() call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Two", reflect.TypeOf((*MockBar[T, R])(nil).Two), arg0) - return &BarTwoCall[T, R]{Call: call} + return &MockBarTwoCall[T, R]{Call: call} } -// BarTwoCall wrap *gomock.Call -type BarTwoCall[T any, R any] struct { +// MockBarTwoCall wrap *gomock.Call +type MockBarTwoCall[T any, R any] struct { *gomock.Call } // Return rewrite *gomock.Call.Return -func (c *BarTwoCall[T, R]) Return(arg0 string) *BarTwoCall[T, R] { +func (c *MockBarTwoCall[T, R]) Return(arg0 string) *MockBarTwoCall[T, R] { c.Call = c.Call.Return(arg0) return c } // Do rewrite *gomock.Call.Do -func (c *BarTwoCall[T, R]) Do(f func(T) string) *BarTwoCall[T, R] { +func (c *MockBarTwoCall[T, R]) Do(f func(T) string) *MockBarTwoCall[T, R] { c.Call = c.Call.Do(f) return c } // DoAndReturn rewrite *gomock.Call.DoAndReturn -func (c *BarTwoCall[T, R]) DoAndReturn(f func(T) string) *BarTwoCall[T, R] { +func (c *MockBarTwoCall[T, R]) DoAndReturn(f func(T) string) *MockBarTwoCall[T, R] { c.Call = c.Call.DoAndReturn(f) return c } - -// MockIface is a mock of Iface interface. -type MockIface[T any] struct { - ctrl *gomock.Controller - recorder *MockIfaceMockRecorder[T] -} - -// MockIfaceMockRecorder is the mock recorder for MockIface. -type MockIfaceMockRecorder[T any] struct { - mock *MockIface[T] -} - -// NewMockIface creates a new mock instance. -func NewMockIface[T any](ctrl *gomock.Controller) *MockIface[T] { - mock := &MockIface[T]{ctrl: ctrl} - mock.recorder = &MockIfaceMockRecorder[T]{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockIface[T]) EXPECT() *MockIfaceMockRecorder[T] { - return m.recorder -} diff --git a/mockgen/internal/tests/typed_inorder/mock.go b/mockgen/internal/tests/typed_inorder/mock.go index 97301a9..ff98128 100644 --- a/mockgen/internal/tests/typed_inorder/mock.go +++ b/mockgen/internal/tests/typed_inorder/mock.go @@ -38,6 +38,11 @@ func (m *MockAnimal) EXPECT() *MockAnimalMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockAnimal) ISGOMOCK() struct{} { + return struct{}{} +} + // Feed mocks base method. func (m *MockAnimal) Feed(arg0 string) error { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/unexported_method/bugreport_mock.go b/mockgen/internal/tests/unexported_method/bugreport_mock.go index 0f11c48..8cb2e03 100644 --- a/mockgen/internal/tests/unexported_method/bugreport_mock.go +++ b/mockgen/internal/tests/unexported_method/bugreport_mock.go @@ -38,6 +38,11 @@ func (m *MockExample) EXPECT() *MockExampleMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockExample) ISGOMOCK() struct{} { + return struct{}{} +} + // someMethod mocks base method. func (m *MockExample) someMethod(arg0 string) string { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/vendor_dep/mock.go b/mockgen/internal/tests/vendor_dep/mock.go index 7862124..7ce6fd4 100644 --- a/mockgen/internal/tests/vendor_dep/mock.go +++ b/mockgen/internal/tests/vendor_dep/mock.go @@ -39,6 +39,11 @@ func (m *MockVendorsDep) EXPECT() *MockVendorsDepMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockVendorsDep) ISGOMOCK() struct{} { + return struct{}{} +} + // Foo mocks base method. func (m *MockVendorsDep) Foo() present.Elem { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/vendor_dep/source_mock_package/mock.go b/mockgen/internal/tests/vendor_dep/source_mock_package/mock.go index 8092c70..b55394a 100644 --- a/mockgen/internal/tests/vendor_dep/source_mock_package/mock.go +++ b/mockgen/internal/tests/vendor_dep/source_mock_package/mock.go @@ -39,6 +39,11 @@ func (m *MockVendorsDep) EXPECT() *MockVendorsDepMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockVendorsDep) ISGOMOCK() struct{} { + return struct{}{} +} + // Foo mocks base method. func (m *MockVendorsDep) Foo() present.Elem { m.ctrl.T.Helper() diff --git a/mockgen/internal/tests/vendor_pkg/mock.go b/mockgen/internal/tests/vendor_pkg/mock.go index 6276ec1..10eb886 100644 --- a/mockgen/internal/tests/vendor_pkg/mock.go +++ b/mockgen/internal/tests/vendor_pkg/mock.go @@ -38,6 +38,11 @@ func (m *MockElem) EXPECT() *MockElemMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockElem) ISGOMOCK() struct{} { + return struct{}{} +} + // TemplateName mocks base method. func (m *MockElem) TemplateName() string { m.ctrl.T.Helper() diff --git a/sample/concurrent/mock/concurrent_mock.go b/sample/concurrent/mock/concurrent_mock.go index b397185..cc74e54 100644 --- a/sample/concurrent/mock/concurrent_mock.go +++ b/sample/concurrent/mock/concurrent_mock.go @@ -38,6 +38,11 @@ func (m *MockMath) EXPECT() *MockMathMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockMath) ISGOMOCK() struct{} { + return struct{}{} +} + // Sum mocks base method. func (m *MockMath) Sum(arg0, arg1 int) int { m.ctrl.T.Helper() diff --git a/sample/mock_user_test.go b/sample/mock_user_test.go index f5f3e69..4025a9d 100644 --- a/sample/mock_user_test.go +++ b/sample/mock_user_test.go @@ -49,6 +49,11 @@ func (m *MockIndex) EXPECT() *MockIndexMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockIndex) ISGOMOCK() struct{} { + return struct{}{} +} + // Anon mocks base method. func (m *MockIndex) Anon(arg0 string) { m.ctrl.T.Helper() @@ -358,6 +363,11 @@ func (m *MockEmbed) EXPECT() *MockEmbedMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockEmbed) ISGOMOCK() struct{} { + return struct{}{} +} + // EmbeddedMethod mocks base method. func (m *MockEmbed) EmbeddedMethod() { m.ctrl.T.Helper() @@ -431,6 +441,11 @@ func (m *MockEmbedded) EXPECT() *MockEmbeddedMockRecorder { return m.recorder } +// ISGOMOCK indicates that this struct is a gomock mock. +func (m *MockEmbedded) ISGOMOCK() struct{} { + return struct{}{} +} + // EmbeddedMethod mocks base method. func (m *MockEmbedded) EmbeddedMethod() { m.ctrl.T.Helper()