After chatting w/ some gophers on twitter, I ended up with: https://play.golang.org/p/UJu4WAmkHk
It defaults the embedded interface to an "no-op" implementation (NilEventLog) rather than nil, which was the best approach for my particular issue. On Wednesday, December 7, 2016 at 11:32:42 AM UTC-8, Traun Leyden wrote: > > > What's the best practice around handling embedded interfaces that are nil? > > For example: > > https://play.golang.org/p/EcqV7h9cNU > > Is there a better way than wrapping the embedded interface's methods and > forwarding down as long as it's not nil? > > I guess another approach would be to create a NoOpEventLog in the > NewService() function which would ignore any calls to service.SaveEvent(). > -- 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. For more options, visit https://groups.google.com/d/optout.