It seems like you would need to do both, at least eventually. I'm not sure why you're saying that you will end up copy-pasting the comments; it seems like each implementation would have something particular about it that would change the documentation. For example, io.Reader must be documented at the interface level and implementations like bytes.Buffer have slightly different or more specific documentation for the Read and Write methods. If the comments are shared between the interface and the implementation, you could just elide the comments on the implementation's methods or mention that it implements your database driver's interface.
On Mon, Jan 9, 2017 at 1:39 PM, Nathan Morley <vivace.naa...@gmail.com> wrote: > Hey all, > > I have a brief question on the "best practices" for documenting Go code. I > did a quick sweep through the official blog as well as the Effective Go > article, but found no answer as of yet... > > Let's say I have an interface like a database driver that gets implemented > in multiple places. Which is better: to document just the interface itself, > the interface and the clients that implement it, or just the clients? > > I ask because if one were to have several implementations of a single > interface, it quickly can become tiresome to copy/paste your comments > around for the sake of consistency if you re-word something. I recognize > that this may be one of those things best left up to the developer(s) at > the time of development, and people may have several differing opinions on > what is "best" here, but I'm curious. > > Thanks in advance, > > Morley > > -- > 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. > -- 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.