3 ms·
> The compiler does a whole load of checking which can (and therefore should) be automated, which in many other languages is left to the developer. Go code tend
by codygman 11y ago
> The compiler does a whole load of checking which can (and therefore should) be automated, which in many other languages is left to the developer. Go code tends to have the property that if it compiles, it probably works as designed.
As someone who works with Go daily, these statements are both very untrue. Claiming "if it compiles it works" applies to Go code makes my eye twitchy.
For instance, type assertions have no exhaustivity checker. Interface{} and liberal usage of it throws type safety out the window.
> the package management is lovely,
Go doesn't have package management per SE, just vendoring.
- mjw_byrne 11y agoI did fudge a little - "tends" and "probably". Of course compilation is not a guarantee of correctness, I just find that it gets me most of the way there. JavaScript, by comparison, feels like it's trying to give you rope to hang yourself. Maybe I'm abusing the term "package management". I'm talking about go get, the way imports function, the cute private/public lowercase/uppercase mechanism, the recently-added vendoring support etc.