6 ms·
A lot of advice I've seen (such as this) postdates much of the standard library implementation by quite a bit. I could not, however, suggest that the current de
by peterevans 9y ago
A lot of advice I've seen (such as this) postdates much of the standard library implementation by quite a bit. I could not, however, suggest that the current design for crypt is good or bad, for I have not used it often enough to offer a worthy opinion.
People seem to really click with the net/http design, and that does seem well done, but I imagine the standard library itself is a bit unevenly architected.
- tptacek 9y agoThe 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.
- dsymonds 9y agoThat'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.
- tptacek 9y agocontext also returns context.Context (an interface), and sql returns driver.Value, an interface.
- dsymonds 9y agocontext.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).