logoalt Hacker News

red_admiraltoday at 11:03 AM1 replyview on HN

Another of mine: don't name a struct after an interface method that it's supposed to implement. If you have a package linearalgebra, then making a custom error type linearalgebra.LinearAlgebraError is too "chatty" but linearalgebra.Error will cause you pain if it implements "Error string()", as it probably should, and you decide to make a linearalgebra.MatrixSingularError that wraps a linearalgebra.Error to "inherit" its methods.

In the end, it ended up called linearalgebra.Err .

P.S Alex Edwards' "let's go" and "let's go further" are great books to get someone up to date with golang, just keep an eye on features that are newer than the book(s).


Replies

DauntingPear7today at 12:07 PM

The booms receive regular updates. I got an email about an update to Let’s Go Further on 3/12 for Go 1.26