logoalt Hacker News

aftbit11/08/20242 repliesview on HN

You're intended to run gofmt on every save. golang is designed to be a sort of straight-jacket that forces everyone to write code in the same way (style etc) so that the junior devs can understand it clearly.


Replies

grey-area11/08/2024

And so that people (of any level) don't bikeshed over silly things like tabs and spaces or { and newlines.

I really like this about go - that it formats code for you, and miss it in other languages where we have linters but not formatters, which is a terrible idea IMO.

show 2 replies
guappa11/11/2024

Why are you talking about go fmt? I'm talking about parser of the go language

If I write

    if x
    {
    bla
    }
it will not compile, because the { needs to be on the same line as the X (for no reason whatsoever).