Gopherfest 2015 | Go Proverbs with Rob Pike
Why Hacker News recommends it
HN treats it as the canonical source for Go proverbs, quoted in debates about dependencies, concurrency and simplicity.
What it is
Rob Pike presents Go Proverbs at Gopherfest 2015, a set of pithy aphorisms about Go design such as 'Clear is better than clever' and 'A little copying is better than a little dependency'.
Recommended by 1 HN commenters across 1 different months, 2016 to 2026.
What Hacker News said
Strong rec Dawny33 · 2016-04 · on “Go Proverbs: Simple, Poetic, Pithy”
Just in case you haven't read the footer text: The proverbs are based on this awesome talk by Rob Spike: [this video] And for new proverb ideas, you can open an issue here: [LINK]
Cites dpflan · 2018-04 · on “Hello Go”
Indeed, taken from "Go Proverbs" - [LINK] "Concurrency is not parallelism." > Video: [this video]
Cites mtalantikite · 2020-04 · on “Pulumi – Modern Infrastructure as Code”
"For comparison, this Amazon VPC example may be worth checking out" It might be better to compare how to use the module/stack: - Terraform: [LINK] - Pulumi: [LINK] So as a user, can I configure this Pulumi VPC stack before it's instantiated? Or do I have to use the defaults first and then use the CLI to change things? Do these CLI changes then get placed into code, or just into state? Does that mean I'm now in a situation where the code doesn't match the state? Personally I find the Terraform configuration much easier to reason about, I see exactly where resources are declared just by scanning the file. (But I've also used Terraform a lot). Edit: Ah, maybe I have to configure it via this con
Cites shadowgovt · 2021-02 · on “Leveraging the Go Type System”
A constructor is just a function though... If I add a new field to a Java class and fail to add its initialization to the constructor, I have the exact same problem because Java initializes the field to its default value when the constructor is called. You are correct that every situation where the struct in Go is initialized "bare" would need to be addressed if a field is added, but Go considers this a feature, not a bug (and, conversely, considers "bare initialization" of structs at dozens of places in your code to be bad practice if that struct could ever grow new fields). If you're bare-initializing structs, you're comfortable using them in a "loosey-goosey" context where zero-initialize
Cites jrockway · 2021-05 · on ““Shared libraries are not a good thing in general””
Vendoring is when you just copy the dependencies into your own source tree, like in a third_party directory. Personally, I'm a big fan of just taking what you need. A little copying is better than a little dependency[1]. [1] [this video]
Cites thegeekpirate · 2022-03 · on “Go 1.18”
You've also opened yourself up to bugs by allowing the map values to be "false". Using a "set's" value in an if statement doesn't make sense either, compared to if _, exists := something[item]; exists { ... } which is explicit regarding what's actually going on. As Rob said, "Clear is better than clever." [this video] I also don't want to be hunting down whoever creates a map[T]bool and doesn't leave a comment explaining it's a set ;) Hopefully we won't have to worry about it for much longer regardless, since I imagine we'll be using proper sets (with methods) some point in the near future.
Cites paskozdilar · 2022-05 · on “Safety and Performance – Threadsafe Datastructures in C++”
Agreed. The problem with mutex is that it's often hard to get right, since it's a low-level primitive for serializing access to shared memory, and it does not compose (cannot atomically lock two mutexes). CSP/Actor model simply takes the problem that mutex solves on the low level - concurrency - and makes the whole world concurrent-by-default, so that mutexes are not needed. Note the 1st Go proverb [0]: "Don't communicate by sharing memory, share memory by communicating." [0] [this video]
Cites barsonme · 2022-10 · on “No safe efficient ways to do three-way string comparisons in Go”
I think manual three-way comparisons are very clear. But so is strings.Compare. For better or worse, copying code is a pretty normal thing to do in Go. See "A little copying is better than a little dependency." [0] [0]: [this video]