From 33ccc990781d28f8a296efe486196597d915792e Mon Sep 17 00:00:00 2001 From: Jacob Oaks Date: Wed, 18 Sep 2024 15:00:49 -0400 Subject: [PATCH] Avoid stringer-related deadlocks without adding ISGOMOCK (#204) A deadlock related to controller calling Stringer on mocks themselves was revealed in #116. #144 solved this deadlock by adding a generated `ISGOMOCK()` method to all generated mocks, and then checking for it before calling `.String()` on arguments. This reveals an exported method on each generated mock that: * Bloats the generated code * Can be taken dependency on in strange ways via Hyrum's Law * Technically opens up another route for naming collision. This PR attempts to clean up this type of check by instead generating an unexported field in generated mock structs instead, and checks for it using reflect. This hides this implementation detail of gomock/mockgen better, and produces less generated bloat. Note that, importantly, the regression test added in #144 still passes with this PR. Ref: #193 --- gomock/internal/mock_gomock/mock_matcher.go | 6 +-- gomock/mock_test.go | 6 +-- gomock/string.go | 43 ++++++++++++------- .../tests/add_generate_directive/mock.go | 6 +-- .../internal/tests/const_array_length/mock.go | 6 +-- mockgen/internal/tests/copyright_file/mock.go | 6 +-- .../greeter/greeter_mock_test.go | 6 +-- .../tests/defined_import_local_name/mock.go | 6 +-- mockgen/internal/tests/dot_imports/mock.go | 6 +-- .../internal/tests/empty_interface/mock.go | 6 +-- mockgen/internal/tests/exclude/mock.go | 6 +-- mockgen/internal/tests/extra_import/mock.go | 6 +-- .../bugreport_mock.go | 6 +-- .../generics/source/mock_external_mock.go | 24 ++--------- .../generics/source/mock_generics_mock.go | 36 +++------------- .../bugreport_mock.go | 6 +-- .../import_embedded_interface/net_mock.go | 6 +-- .../import_source/definition/source_mock.go | 6 +-- .../tests/import_source/source_mock.go | 6 +-- .../subdir/internal/pkg/source_output/mock.go | 12 +----- .../missing_import/output/source_mock.go | 6 +-- .../tests/mock_in_test_package/mock_test.go | 6 +-- .../tests/mock_name/mocks/post_service.go | 6 +-- .../tests/mock_name/mocks/user_service.go | 6 +-- .../tests/overlapping_methods/mock.go | 6 +-- .../internal/tests/package_comment/mock.go | 6 +-- .../internal/tests/panicing_test/mock_test.go | 6 +-- .../tests/sanitization/mockout/mock.go | 6 +-- mockgen/internal/tests/self_package/mock.go | 6 +-- .../internal/tests/test_package/mock_test.go | 6 +-- .../internal/tests/typed/bugreport_mock.go | 6 +-- .../tests/typed/source/mock_external_test.go | 6 +-- .../tests/typed/source/mock_generics_test.go | 6 +-- mockgen/internal/tests/typed_inorder/mock.go | 6 +-- .../tests/unexported_method/bugreport_mock.go | 6 +-- mockgen/internal/tests/vendor_dep/mock.go | 6 +-- .../vendor_dep/source_mock_package/mock.go | 6 +-- mockgen/internal/tests/vendor_pkg/mock.go | 6 +-- mockgen/mockgen.go | 9 +--- sample/concurrent/mock/concurrent_mock.go | 6 +-- sample/mock_user_test.go | 18 ++------ 41 files changed, 78 insertions(+), 274 deletions(-) diff --git a/gomock/internal/mock_gomock/mock_matcher.go b/gomock/internal/mock_gomock/mock_matcher.go index fb0693c..2558913 100644 --- a/gomock/internal/mock_gomock/mock_matcher.go +++ b/gomock/internal/mock_gomock/mock_matcher.go @@ -19,6 +19,7 @@ import ( type MockMatcher struct { ctrl *gomock.Controller recorder *MockMatcherMockRecorder + isgomock struct{} } // MockMatcherMockRecorder is the mock recorder for MockMatcher. @@ -38,11 +39,6 @@ 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/gomock/mock_test.go b/gomock/mock_test.go index aa632a4..8b3ca38 100644 --- a/gomock/mock_test.go +++ b/gomock/mock_test.go @@ -19,6 +19,7 @@ import ( type MockFoo struct { ctrl *gomock.Controller recorder *MockFooMockRecorder + isgomock struct{} } // MockFooMockRecorder is the mock recorder for MockFoo. @@ -38,11 +39,6 @@ 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) string { m.ctrl.T.Helper() diff --git a/gomock/string.go b/gomock/string.go index 6daf917..ec4ca7e 100644 --- a/gomock/string.go +++ b/gomock/string.go @@ -1,25 +1,36 @@ package gomock -import "fmt" - -type mockInstance interface { - ISGOMOCK() struct{} -} -type mockedStringer interface { - fmt.Stringer - mockInstance -} +import ( + "fmt" + "reflect" +) // getString is a safe way to convert a value to a string for printing results // If the value is a a mock, getString avoids calling the mocked String() method, // which avoids potential deadlocks func getString(x any) string { - switch v := x.(type) { - case mockedStringer: - return fmt.Sprintf("%T", v) - case fmt.Stringer: - return v.String() - default: - return fmt.Sprintf("%v", v) + if isGeneratedMock(x) { + return fmt.Sprintf("%T", x) + } + if s, ok := x.(fmt.Stringer); ok { + return s.String() + } + return fmt.Sprintf("%v", x) +} + +// isGeneratedMock checks if the given type has a "isgomock" field, +// indicating it is a generated mock. +func isGeneratedMock(x any) bool { + typ := reflect.TypeOf(x) + if typ == nil { + return false + } + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + if typ.Kind() != reflect.Struct { + return false } + _, isgomock := typ.FieldByName("isgomock") + return isgomock } diff --git a/mockgen/internal/tests/add_generate_directive/mock.go b/mockgen/internal/tests/add_generate_directive/mock.go index 1594548..2cd489e 100644 --- a/mockgen/internal/tests/add_generate_directive/mock.go +++ b/mockgen/internal/tests/add_generate_directive/mock.go @@ -21,6 +21,7 @@ import ( type MockFoo struct { ctrl *gomock.Controller recorder *MockFooMockRecorder + isgomock struct{} } // MockFooMockRecorder is the mock recorder for MockFoo. @@ -40,11 +41,6 @@ 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 844a9ab..c1ec7f8 100644 --- a/mockgen/internal/tests/const_array_length/mock.go +++ b/mockgen/internal/tests/const_array_length/mock.go @@ -19,6 +19,7 @@ import ( type MockI struct { ctrl *gomock.Controller recorder *MockIMockRecorder + isgomock struct{} } // MockIMockRecorder is the mock recorder for MockI. @@ -38,11 +39,6 @@ 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 cd71bea..8408cda 100644 --- a/mockgen/internal/tests/copyright_file/mock.go +++ b/mockgen/internal/tests/copyright_file/mock.go @@ -24,6 +24,7 @@ import ( type MockEmpty struct { ctrl *gomock.Controller recorder *MockEmptyMockRecorder + isgomock struct{} } // MockEmptyMockRecorder is the mock recorder for MockEmpty. @@ -42,8 +43,3 @@ 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 1eaa93c..f87a3c3 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 @@ -20,6 +20,7 @@ import ( type MockInputMaker struct { ctrl *gomock.Controller recorder *MockInputMakerMockRecorder + isgomock struct{} } // MockInputMakerMockRecorder is the mock recorder for MockInputMaker. @@ -39,11 +40,6 @@ 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 9648c8f..810f364 100644 --- a/mockgen/internal/tests/defined_import_local_name/mock.go +++ b/mockgen/internal/tests/defined_import_local_name/mock.go @@ -21,6 +21,7 @@ import ( type MockWithImports struct { ctrl *gomock.Controller recorder *MockWithImportsMockRecorder + isgomock struct{} } // MockWithImportsMockRecorder is the mock recorder for MockWithImports. @@ -40,11 +41,6 @@ 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 20d27d3..e941ee1 100644 --- a/mockgen/internal/tests/dot_imports/mock.go +++ b/mockgen/internal/tests/dot_imports/mock.go @@ -22,6 +22,7 @@ import ( type MockWithDotImports struct { ctrl *gomock.Controller recorder *MockWithDotImportsMockRecorder + isgomock struct{} } // MockWithDotImportsMockRecorder is the mock recorder for MockWithDotImports. @@ -41,11 +42,6 @@ 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 6656e40..bff5ea1 100644 --- a/mockgen/internal/tests/empty_interface/mock.go +++ b/mockgen/internal/tests/empty_interface/mock.go @@ -17,6 +17,7 @@ import ( type MockEmpty struct { ctrl *gomock.Controller recorder *MockEmptyMockRecorder + isgomock struct{} } // MockEmptyMockRecorder is the mock recorder for MockEmpty. @@ -35,8 +36,3 @@ 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 4f219ae..304e018 100644 --- a/mockgen/internal/tests/exclude/mock.go +++ b/mockgen/internal/tests/exclude/mock.go @@ -19,6 +19,7 @@ import ( type MockGenerateMockForMe struct { ctrl *gomock.Controller recorder *MockGenerateMockForMeMockRecorder + isgomock struct{} } // MockGenerateMockForMeMockRecorder is the mock recorder for MockGenerateMockForMe. @@ -38,11 +39,6 @@ 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 1c3173c..da611a8 100644 --- a/mockgen/internal/tests/extra_import/mock.go +++ b/mockgen/internal/tests/extra_import/mock.go @@ -19,6 +19,7 @@ import ( type MockFoo struct { ctrl *gomock.Controller recorder *MockFooMockRecorder + isgomock struct{} } // MockFooMockRecorder is the mock recorder for MockFoo. @@ -38,11 +39,6 @@ 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 cf871e1..e066b90 100644 --- a/mockgen/internal/tests/generated_identifier_conflict/bugreport_mock.go +++ b/mockgen/internal/tests/generated_identifier_conflict/bugreport_mock.go @@ -19,6 +19,7 @@ import ( type MockExample struct { ctrl *gomock.Controller recorder *MockExampleMockRecorder + isgomock struct{} } // MockExampleMockRecorder is the mock recorder for MockExample. @@ -38,11 +39,6 @@ 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 20df447..39d0601 100644 --- a/mockgen/internal/tests/generics/source/mock_external_mock.go +++ b/mockgen/internal/tests/generics/source/mock_external_mock.go @@ -23,6 +23,7 @@ import ( type MockExternalConstraint[I constraints.Integer, F any] struct { ctrl *gomock.Controller recorder *MockExternalConstraintMockRecorder[I, F] + isgomock struct{} } // MockExternalConstraintMockRecorder is the mock recorder for MockExternalConstraint. @@ -42,11 +43,6 @@ 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() @@ -233,6 +229,7 @@ func (mr *MockExternalConstraintMockRecorder[I, F]) Two(arg0 any) *gomock.Call { type MockEmbeddingIface[T constraints.Integer, R constraints.Float] struct { ctrl *gomock.Controller recorder *MockEmbeddingIfaceMockRecorder[T, R] + isgomock struct{} } // MockEmbeddingIfaceMockRecorder is the mock recorder for MockEmbeddingIface. @@ -252,11 +249,6 @@ 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() @@ -542,6 +534,7 @@ func (mr *MockEmbeddingIfaceMockRecorder[T, R]) Water(arg0 any) *gomock.Call { type MockGenerator[T any] struct { ctrl *gomock.Controller recorder *MockGeneratorMockRecorder[T] + isgomock struct{} } // MockGeneratorMockRecorder is the mock recorder for MockGenerator. @@ -561,11 +554,6 @@ 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() @@ -584,6 +572,7 @@ func (mr *MockGeneratorMockRecorder[T]) Generate() *gomock.Call { type MockGroup[T generics.Generator[any]] struct { ctrl *gomock.Controller recorder *MockGroupMockRecorder[T] + isgomock struct{} } // MockGroupMockRecorder is the mock recorder for MockGroup. @@ -603,11 +592,6 @@ 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 39c331b..d145d90 100644 --- a/mockgen/internal/tests/generics/source/mock_generics_mock.go +++ b/mockgen/internal/tests/generics/source/mock_generics_mock.go @@ -22,6 +22,7 @@ import ( type MockBar[T any, R any] struct { ctrl *gomock.Controller recorder *MockBarMockRecorder[T, R] + isgomock struct{} } // MockBarMockRecorder is the mock recorder for MockBar. @@ -41,11 +42,6 @@ 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() @@ -320,6 +316,7 @@ func (mr *MockBarMockRecorder[T, R]) Two(arg0 any) *gomock.Call { type MockUniverse[T constraints.Signed] struct { ctrl *gomock.Controller recorder *MockUniverseMockRecorder[T] + isgomock struct{} } // MockUniverseMockRecorder is the mock recorder for MockUniverse. @@ -339,11 +336,6 @@ 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() @@ -362,6 +354,7 @@ func (mr *MockUniverseMockRecorder[T]) Water(arg0 any) *gomock.Call { type MockMilkyWay[R constraints.Integer] struct { ctrl *gomock.Controller recorder *MockMilkyWayMockRecorder[R] + isgomock struct{} } // MockMilkyWayMockRecorder is the mock recorder for MockMilkyWay. @@ -381,11 +374,6 @@ 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() @@ -404,6 +392,7 @@ func (mr *MockMilkyWayMockRecorder[R]) Water(arg0 any) *gomock.Call { type MockSolarSystem[T constraints.Ordered] struct { ctrl *gomock.Controller recorder *MockSolarSystemMockRecorder[T] + isgomock struct{} } // MockSolarSystemMockRecorder is the mock recorder for MockSolarSystem. @@ -423,11 +412,6 @@ 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() @@ -446,6 +430,7 @@ func (mr *MockSolarSystemMockRecorder[T]) Water(arg0 any) *gomock.Call { type MockEarth[R any] struct { ctrl *gomock.Controller recorder *MockEarthMockRecorder[R] + isgomock struct{} } // MockEarthMockRecorder is the mock recorder for MockEarth. @@ -465,11 +450,6 @@ 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() @@ -488,6 +468,7 @@ func (mr *MockEarthMockRecorder[R]) Water(arg0 any) *gomock.Call { type MockWater[R any, C generics.UnsignedInteger] struct { ctrl *gomock.Controller recorder *MockWaterMockRecorder[R, C] + isgomock struct{} } // MockWaterMockRecorder is the mock recorder for MockWater. @@ -507,11 +488,6 @@ 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 5564c86..bd89e59 100644 --- a/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go +++ b/mockgen/internal/tests/import_embedded_interface/bugreport_mock.go @@ -21,6 +21,7 @@ import ( type MockSource struct { ctrl *gomock.Controller recorder *MockSourceMockRecorder + isgomock struct{} } // MockSourceMockRecorder is the mock recorder for MockSource. @@ -40,11 +41,6 @@ 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 1f7ba06..0c7da5b 100644 --- a/mockgen/internal/tests/import_embedded_interface/net_mock.go +++ b/mockgen/internal/tests/import_embedded_interface/net_mock.go @@ -20,6 +20,7 @@ import ( type MockNet struct { ctrl *gomock.Controller recorder *MockNetMockRecorder + isgomock struct{} } // MockNetMockRecorder is the mock recorder for MockNet. @@ -39,11 +40,6 @@ 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 318544a..a819a6a 100644 --- a/mockgen/internal/tests/import_source/definition/source_mock.go +++ b/mockgen/internal/tests/import_source/definition/source_mock.go @@ -19,6 +19,7 @@ import ( type MockS struct { ctrl *gomock.Controller recorder *MockSMockRecorder + isgomock struct{} } // MockSMockRecorder is the mock recorder for MockS. @@ -38,11 +39,6 @@ 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 7605f4a..5538ed7 100644 --- a/mockgen/internal/tests/import_source/source_mock.go +++ b/mockgen/internal/tests/import_source/source_mock.go @@ -20,6 +20,7 @@ import ( type MockS struct { ctrl *gomock.Controller recorder *MockSMockRecorder + isgomock struct{} } // MockSMockRecorder is the mock recorder for MockS. @@ -39,11 +40,6 @@ 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 0f841bf..52adf40 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 @@ -20,6 +20,7 @@ import ( type MockArg struct { ctrl *gomock.Controller recorder *MockArgMockRecorder + isgomock struct{} } // MockArgMockRecorder is the mock recorder for MockArg. @@ -39,11 +40,6 @@ 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() @@ -62,6 +58,7 @@ func (mr *MockArgMockRecorder) Foo() *gomock.Call { type MockIntf struct { ctrl *gomock.Controller recorder *MockIntfMockRecorder + isgomock struct{} } // MockIntfMockRecorder is the mock recorder for MockIntf. @@ -81,11 +78,6 @@ 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 7f20a99..3f38ad8 100644 --- a/mockgen/internal/tests/missing_import/output/source_mock.go +++ b/mockgen/internal/tests/missing_import/output/source_mock.go @@ -20,6 +20,7 @@ import ( type MockBar struct { ctrl *gomock.Controller recorder *MockBarMockRecorder + isgomock struct{} } // MockBarMockRecorder is the mock recorder for MockBar. @@ -39,11 +40,6 @@ 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 6b187d8..ead45ab 100644 --- a/mockgen/internal/tests/mock_in_test_package/mock_test.go +++ b/mockgen/internal/tests/mock_in_test_package/mock_test.go @@ -20,6 +20,7 @@ import ( type MockFinder struct { ctrl *gomock.Controller recorder *MockFinderMockRecorder + isgomock struct{} } // MockFinderMockRecorder is the mock recorder for MockFinder. @@ -39,11 +40,6 @@ 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 d1dcc6d..d8dc033 100644 --- a/mockgen/internal/tests/mock_name/mocks/post_service.go +++ b/mockgen/internal/tests/mock_name/mocks/post_service.go @@ -21,6 +21,7 @@ import ( type PostServiceMock struct { ctrl *gomock.Controller recorder *PostServiceMockMockRecorder + isgomock struct{} } // PostServiceMockMockRecorder is the mock recorder for PostServiceMock. @@ -40,11 +41,6 @@ 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 8842eae..6447691 100644 --- a/mockgen/internal/tests/mock_name/mocks/user_service.go +++ b/mockgen/internal/tests/mock_name/mocks/user_service.go @@ -20,6 +20,7 @@ import ( type UserServiceMock struct { ctrl *gomock.Controller recorder *UserServiceMockMockRecorder + isgomock struct{} } // UserServiceMockMockRecorder is the mock recorder for UserServiceMock. @@ -39,11 +40,6 @@ 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 2cd0751..7f5c44b 100644 --- a/mockgen/internal/tests/overlapping_methods/mock.go +++ b/mockgen/internal/tests/overlapping_methods/mock.go @@ -19,6 +19,7 @@ import ( type MockReadWriteCloser struct { ctrl *gomock.Controller recorder *MockReadWriteCloserMockRecorder + isgomock struct{} } // MockReadWriteCloserMockRecorder is the mock recorder for MockReadWriteCloser. @@ -38,11 +39,6 @@ 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/package_comment/mock.go b/mockgen/internal/tests/package_comment/mock.go index 8b5a097..f2fb9fb 100644 --- a/mockgen/internal/tests/package_comment/mock.go +++ b/mockgen/internal/tests/package_comment/mock.go @@ -16,6 +16,7 @@ import ( type MockEmpty struct { ctrl *gomock.Controller recorder *MockEmptyMockRecorder + isgomock struct{} } // MockEmptyMockRecorder is the mock recorder for MockEmpty. @@ -34,8 +35,3 @@ 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/panicing_test/mock_test.go b/mockgen/internal/tests/panicing_test/mock_test.go index 42e5fae..aef67e6 100644 --- a/mockgen/internal/tests/panicing_test/mock_test.go +++ b/mockgen/internal/tests/panicing_test/mock_test.go @@ -19,6 +19,7 @@ import ( type MockFoo struct { ctrl *gomock.Controller recorder *MockFooMockRecorder + isgomock struct{} } // MockFooMockRecorder is the mock recorder for MockFoo. @@ -38,11 +39,6 @@ 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 8e130b9..345d2b8 100644 --- a/mockgen/internal/tests/sanitization/mockout/mock.go +++ b/mockgen/internal/tests/sanitization/mockout/mock.go @@ -20,6 +20,7 @@ import ( type MockAnyMock struct { ctrl *gomock.Controller recorder *MockAnyMockMockRecorder + isgomock struct{} } // MockAnyMockMockRecorder is the mock recorder for MockAnyMock. @@ -39,11 +40,6 @@ 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 18494fa..05a5761 100644 --- a/mockgen/internal/tests/self_package/mock.go +++ b/mockgen/internal/tests/self_package/mock.go @@ -19,6 +19,7 @@ import ( type MockMethods struct { ctrl *gomock.Controller recorder *MockMethodsMockRecorder + isgomock struct{} } // MockMethodsMockRecorder is the mock recorder for MockMethods. @@ -38,11 +39,6 @@ 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 e0a5a0d..ed8ca9b 100644 --- a/mockgen/internal/tests/test_package/mock_test.go +++ b/mockgen/internal/tests/test_package/mock_test.go @@ -19,6 +19,7 @@ import ( type MockFinder struct { ctrl *gomock.Controller recorder *MockFinderMockRecorder + isgomock struct{} } // MockFinderMockRecorder is the mock recorder for MockFinder. @@ -38,11 +39,6 @@ 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 00589b1..5c92812 100644 --- a/mockgen/internal/tests/typed/bugreport_mock.go +++ b/mockgen/internal/tests/typed/bugreport_mock.go @@ -20,6 +20,7 @@ import ( type MockSource struct { ctrl *gomock.Controller recorder *MockSourceMockRecorder + isgomock struct{} } // MockSourceMockRecorder is the mock recorder for MockSource. @@ -39,11 +40,6 @@ 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() diff --git a/mockgen/internal/tests/typed/source/mock_external_test.go b/mockgen/internal/tests/typed/source/mock_external_test.go index f74c930..b04f74c 100644 --- a/mockgen/internal/tests/typed/source/mock_external_test.go +++ b/mockgen/internal/tests/typed/source/mock_external_test.go @@ -22,6 +22,7 @@ import ( type MockExternalConstraint[I constraints.Integer, F constraints.Float] struct { ctrl *gomock.Controller recorder *MockExternalConstraintMockRecorder[I, F] + isgomock struct{} } // MockExternalConstraintMockRecorder is the mock recorder for MockExternalConstraint. @@ -41,11 +42,6 @@ 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() diff --git a/mockgen/internal/tests/typed/source/mock_generics_test.go b/mockgen/internal/tests/typed/source/mock_generics_test.go index 40352fe..91228bd 100644 --- a/mockgen/internal/tests/typed/source/mock_generics_test.go +++ b/mockgen/internal/tests/typed/source/mock_generics_test.go @@ -21,6 +21,7 @@ import ( type MockBar[T any, R any] struct { ctrl *gomock.Controller recorder *MockBarMockRecorder[T, R] + isgomock struct{} } // MockBarMockRecorder is the mock recorder for MockBar. @@ -40,11 +41,6 @@ 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() diff --git a/mockgen/internal/tests/typed_inorder/mock.go b/mockgen/internal/tests/typed_inorder/mock.go index ff98128..e7a21e3 100644 --- a/mockgen/internal/tests/typed_inorder/mock.go +++ b/mockgen/internal/tests/typed_inorder/mock.go @@ -19,6 +19,7 @@ import ( type MockAnimal struct { ctrl *gomock.Controller recorder *MockAnimalMockRecorder + isgomock struct{} } // MockAnimalMockRecorder is the mock recorder for MockAnimal. @@ -38,11 +39,6 @@ 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 8cb2e03..5670756 100644 --- a/mockgen/internal/tests/unexported_method/bugreport_mock.go +++ b/mockgen/internal/tests/unexported_method/bugreport_mock.go @@ -19,6 +19,7 @@ import ( type MockExample struct { ctrl *gomock.Controller recorder *MockExampleMockRecorder + isgomock struct{} } // MockExampleMockRecorder is the mock recorder for MockExample. @@ -38,11 +39,6 @@ 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 7ce6fd4..ae663b6 100644 --- a/mockgen/internal/tests/vendor_dep/mock.go +++ b/mockgen/internal/tests/vendor_dep/mock.go @@ -20,6 +20,7 @@ import ( type MockVendorsDep struct { ctrl *gomock.Controller recorder *MockVendorsDepMockRecorder + isgomock struct{} } // MockVendorsDepMockRecorder is the mock recorder for MockVendorsDep. @@ -39,11 +40,6 @@ 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 b55394a..88461e2 100644 --- a/mockgen/internal/tests/vendor_dep/source_mock_package/mock.go +++ b/mockgen/internal/tests/vendor_dep/source_mock_package/mock.go @@ -20,6 +20,7 @@ import ( type MockVendorsDep struct { ctrl *gomock.Controller recorder *MockVendorsDepMockRecorder + isgomock struct{} } // MockVendorsDepMockRecorder is the mock recorder for MockVendorsDep. @@ -39,11 +40,6 @@ 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 10eb886..e32fb0f 100644 --- a/mockgen/internal/tests/vendor_pkg/mock.go +++ b/mockgen/internal/tests/vendor_pkg/mock.go @@ -19,6 +19,7 @@ import ( type MockElem struct { ctrl *gomock.Controller recorder *MockElemMockRecorder + isgomock struct{} } // MockElemMockRecorder is the mock recorder for MockElem. @@ -38,11 +39,6 @@ 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/mockgen/mockgen.go b/mockgen/mockgen.go index 5d57868..6d7634b 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -477,6 +477,7 @@ func (g *generator) GenerateMockInterface(intf *model.Interface, outputPackagePa g.in() g.p("ctrl *gomock.Controller") g.p("recorder *%vMockRecorder%v", mockType, shortTp) + g.p("isgomock struct{}") g.out() g.p("}") g.p("") @@ -507,14 +508,6 @@ func (g *generator) GenerateMockInterface(intf *model.Interface, outputPackagePa g.out() g.p("}") - // XXX: possible name collision here if someone has ISGOMOCK in their interface. - g.p("// ISGOMOCK indicates that this struct is a gomock mock.") - g.p("func (m *%v%v) ISGOMOCK() struct{} {", mockType, shortTp) - g.in() - g.p("return struct{}{}") - g.out() - g.p("}") - g.GenerateMockMethods(mockType, intf, outputPackagePath, longTp, shortTp, *typed) return nil diff --git a/sample/concurrent/mock/concurrent_mock.go b/sample/concurrent/mock/concurrent_mock.go index cc74e54..eb6bb28 100644 --- a/sample/concurrent/mock/concurrent_mock.go +++ b/sample/concurrent/mock/concurrent_mock.go @@ -19,6 +19,7 @@ import ( type MockMath struct { ctrl *gomock.Controller recorder *MockMathMockRecorder + isgomock struct{} } // MockMathMockRecorder is the mock recorder for MockMath. @@ -38,11 +39,6 @@ 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 4025a9d..7c48043 100644 --- a/sample/mock_user_test.go +++ b/sample/mock_user_test.go @@ -30,6 +30,7 @@ import ( type MockIndex struct { ctrl *gomock.Controller recorder *MockIndexMockRecorder + isgomock struct{} } // MockIndexMockRecorder is the mock recorder for MockIndex. @@ -49,11 +50,6 @@ 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() @@ -344,6 +340,7 @@ func (mr *MockIndexMockRecorder) Templates(arg0, arg1 any) *gomock.Call { type MockEmbed struct { ctrl *gomock.Controller recorder *MockEmbedMockRecorder + isgomock struct{} } // MockEmbedMockRecorder is the mock recorder for MockEmbed. @@ -363,11 +360,6 @@ 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() @@ -422,6 +414,7 @@ func (mr *MockEmbedMockRecorder) RegularMethod() *gomock.Call { type MockEmbedded struct { ctrl *gomock.Controller recorder *MockEmbeddedMockRecorder + isgomock struct{} } // MockEmbeddedMockRecorder is the mock recorder for MockEmbedded. @@ -441,11 +434,6 @@ 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()