Hacker News new | past | comments | ask | show | jobs | submit login

A bunch of other docs I've looked up number of times and found handy:

- Slice tricks: https://github.com/golang/go/wiki/SliceTricks

- Rest of the Golang Github Wiki: https://github.com/golang/go/wiki#additional-go-programming-...

- Spec - very approachable: https://golang.org/ref/spec

- Standard library source code - clean code with lots of idioms to learn from: https://cs.opensource.google/go/go/+/refs/tags/go1.17.1:src/




Hopefully, a ton of the slice tricks will soon be replaced with "container/slice" (although you'll still need a few)!

[1] https://github.com/golang/go/issues/45955



Cool I had never seen this before. All seem on point, but I have light disagreements with this one:

> The basic rule: the further from its declaration that a name is used, the more descriptive the name must be. For a method receiver, one or two letters is sufficient. Common variables such as loop indices and readers can be a single letter (i, r). More unusual things and global variables need more descriptive names.

In the tighter parts of some algorithms I love seeing more descriptive variables (obvious exclusions, as noted, are things like i, j, x, y). It's very common to see double letter variable names that become hard to track (plenty in the go source as well).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: