You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Certain interfaces may have a mechanism to guarantee that a specific type is embedded.
For example, the <ServiceName>Server interface generated by protoc-gen-go-grpc contains an unexported mustEmbedUnimplemented<ServiceName>Server method, which can be implemented by embedding the Unimplemented<ServiceName>Server from the same package.
To support this pattern, I propose a feature that allows specified types to be embedded in mocks. For instance, how about running moq -out mocks_test.go . MyInterface{Type1,Type2} (or MyInterface:MyMock{Type1,Type2}) to embed Type1 and Type2 in MyInterface mock?
The text was updated successfully, but these errors were encountered:
Certain interfaces may have a mechanism to guarantee that a specific type is embedded.
For example, the
<ServiceName>Server
interface generated byprotoc-gen-go-grpc
contains an unexportedmustEmbedUnimplemented<ServiceName>Server
method, which can be implemented by embedding theUnimplemented<ServiceName>Server
from the same package.You can find more information here:
https://github.com/grpc/grpc-go/tree/master/cmd/protoc-gen-go-grpc#future-proofing-services
Real examples can be seen in the helloworld example of grpc-go:
To support this pattern, I propose a feature that allows specified types to be embedded in mocks. For instance, how about running
moq -out mocks_test.go . MyInterface{Type1,Type2}
(orMyInterface:MyMock{Type1,Type2}
) to embed Type1 and Type2 in MyInterface mock?The text was updated successfully, but these errors were encountered: