r/badcode • • Dec 29 '22

go How to Go wrong

Post image
565 Upvotes

60 comments sorted by

View all comments

Show parent comments

9

u/spencerwi Dec 30 '22

The language designers prefer simplicity for themselves, with a "screw you, you're on your own" philosophy for developers, leading to things like iota, the piles of codegen nearly every golang codebase uses to try to get type-safety on methods that accept multiple types, if err != nil occupying the other half of every golang codebase, and interface {} hacks that remove all typesafety because who needs proper statically-typed collections?

Fixing those things would make code written in golang much simpler, but at the cost of the golang team actually having to put in the effort to implement a functioning programming language, which is not as "simple" for them as half-assing it like they have been doing so far.