Actual behavior
I'm not able to cast a mocked struct to the actual interface, if it has an un-exported method:
./main_test.go:19:64: cannot use mocks.NewMockTraceServiceServer(mockController) (value of type *mocks.MockTraceServiceServer) as "go.opentelemetry.io/proto/otlp/collector/trace/v1".TraceServiceServer value in variable declaration: *mocks.MockTraceServiceServer does not implement "go.opentelemetry.io/proto/otlp/collector/trace/v1".TraceServiceServer (missing method mustEmbedUnimplementedTraceServiceServer)
FAIL github.com/miparnisari/mockGo [build failed]
Expected behavior
I'm able to cast a mocked struct to the actual interface, if it has an un-exported method, e.g.
type TraceServiceServer interface {
Export(context.Context, *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error)
mustEmbedUnimplementedTraceServiceServer()
}
Actual behavior I'm not able to cast a mocked struct to the actual interface, if it has an un-exported method:
Expected behavior I'm able to cast a mocked struct to the actual interface, if it has an un-exported method, e.g.
To Reproduce
git clone git@github.com:miparnisari/mockGO.git
go generate && go test .
Additional Information