I want off Mr. Golang’s Wild Ride (2020)
Author here: I wrote this in 2020, have changed jobs twice since. Both jobs involved Go in some capacity, where it&#x27;s supposed to shine (web services). It has not been a pleasant experience either - I&#x27;ve lost count of the amount of incidents directly caused by poor error handling, or Go default values.<p>If folks walk away with only one new thought from this, please let it be that: defaults matter. Go lets you whip something up quickly, but making the result &quot;production-ready&quot; is left as an exercise to the writer. Big companies that have adopted it have developed tons of tooling around it, use all available linters, do code generation, check the disassembly, and regularly pay the engineering cost of just using Go at all.<p>That&#x27;s not how most Go code is written though. I&#x27;m interested not in what the language lets you do, but what is typical for a language - what is idiomatic, what &quot;everyone ends up doing&quot;, because it is encouraged.<p>Because that&#x27;s the kind of code I inevitably end up being on-call for, and I&#x27;m tired of being woken up because of the same classes of preventable errors, all the time. It doesn&#x27;t matter that I don&#x27;t personally write Go anymore: it&#x27;s unescapable. If it&#x27;s not internal Go code, it&#x27;s in a SAAS we pay for: and no matter who writes it, it fails in all the same predictable ways.<p>Generics will not solve this. It is &#x2F;neat&#x2F; that they found a way to sneak them into the language, but it&#x27;s not gonna change years of poor design decisions, and it&#x27;s definitely not gonna change the enormous amount of existing Go code out there, especially as the discourse around them not being the usability+performance win everyone thought they would be keeps unfolding.<p>As I&#x27;ve mentioned recently on Twitter, what makes everything worse is that you cannot replace Go piecemeal once it has taken hold in a codebase: its FFI story is painful, the only good boundary with Go is a network boundary, and there&#x27;s often a latency concern there.<p>Lastly: pointing out that I have been teaching Rust is a lazy and dismissive response to this. For me personally, I have found it to be the least awful option in a bunch of cases. I am yearning for even better languages, ones that tackle the same kind of issues but do it even better. I like to remind everyone that we&#x27;re not out there cheering for sports team, just discussing our tools.<p>If you&#x27;re looking to reduce the whole discourse to &quot;X vs Y&quot;, let it be &quot;serde vs crossing your fingers and hoping user input is well-formed&quot;. It is one of the better reductions of the problem: it really is &quot;specifying behavior that should be allowed (and rejecting everything else)&quot; vs &quot;manually checking that everything is fine in a thousand tiny steps&quot;, which inevitably results in missed combinations because the human brain is not designed to hold graphs that big.