On 05/28/2017 02:40 PM, Darko Luketic wrote: > I'm stuck and I hoped it wouldn't come to that. >
As Justin said, interfaces on their own don't do anything and their zero value is nil. Beyond that I'd consider thinking more carefully about your interface names. Whenever I see the word "interface" inside of an interface name it makes me wary. Notice that the standard library doesn't have much of that -- the only one I can think of is sort.Interface. Instead you see Reader, Writer, CookieJar, Valuer, Pinger, Signer, Decrypter, etc... It seems like the best interface names are nouns that describe behavior that other types can comply with. You should be able to define a type and ask your self, "is this type a Writer," or, "is this type a Decrypter?" Notice how, "is this type a UserStorageInterface," doesn't quite roll off the tongue as easily. :) It seems like using a simple and descriptive noun reflects a clearer mental model for what you are trying to abstract. When I see "interface" used in an interface name it tells me that you're not trying to abstract behavior; you're using interfaces purely as a way to wedge functions into some code. -ayan -- 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.