News for hackers. Stuff that matters.
Re:How to Use Go Interfaces by tptacek on Monday March 19, 2018 @08:55PM (#16624952)
The general advice I've always gotten is that if you're looking for well-executed Go idiom, the standard library is your first stop.

And while NewAES might predate this advice, NewGCM (which returns an opaque crypto.AEAD) does not.

Re:How to Use Go Interfaces by dsymonds on Monday March 19, 2018 @09:55PM (#16625347)
That's true, but the standard library also has strictures about backward compatibility that have ossified some bad choices. The crypto examples you give are arguably exactly this; even the later ones are probably a mistake, but are at least consistent with what can't be changed.
Re:How to Use Go Interfaces by tptacek on Monday March 19, 2018 @10:15PM (#16625455)
context also returns context.Context (an interface), and sql returns driver.Value, an interface.
Re:How to Use Go Interfaces by dsymonds on Monday March 19, 2018 @11:44PM (#16625879)
context.Context is an interface because it is known there are multiple implementers (several in the context package itself). The sql driver.Value is actually the other way around: the sql package is the consuming package (for the driver).