The Google Cloud Go library contains the following code (See 
https://github.com/googleapis/google-cloud-go/blob/38a040e213cc8af5b01b3afe422481493f54382f/datastore/client.go#L36
 
)

    // datastoreClient is a wrapper for the pb.DatastoreClient
    type datastoreClient struct {
// Embed so we still implement the DatastoreClient interface,
// if the interface adds more methods.
pb.DatastoreClient
c  pb.DatastoreClient
    }

    func newDatastoreClient() pb.DatastoreClient {
return &datastoreClient{ c: pb.NewDatastoreClient() }
    }

    func (dc *datastoreClient) Lookup() {
    // ...

What could be the reason for both an anonymous and a named structure 
implementation, without initializing the anonymous one? As I understand it, 
this means the compiler no longer complains about missing methods from the 
`pb.DatastoreClient` interface, but it would crash with a nil pointer error 
when they are called?

thanks,
Remko

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/dfe1b583-5d79-4264-9a04-751ced59b73fn%40googlegroups.com.

Reply via email to