4 ms·
This is a philosophical difference, not an oversight. gofmt imposes a single style on the entire go ecosystem, that's unusual as most previous formatters have
by grey-area 9y ago
This is a philosophical difference, not an oversight.
gofmt imposes a single style on the entire go ecosystem, that's unusual as most previous formatters have lots of options, and allow different teams to adopt different styles (e.g. tabs vs spaces). Turns out it doesn't really matter what style you choose as long as everyone uses the same one, and long lines aren't a problem in practice.
Worse is better.
- littlestymaar 9y agoEveryone in a team should use the same conventions. The idea that everyone eveywhere on the world should use the same style has no practical interest : you don't get any productivity from it. It's just a philosophical stance, and a rather totalitarian one IMHO.
- grey-area 9y agoThe idea that everyone eveywhere on the world should use the same style has no practical interest : you don't get any productivity from it. I disagree on that - it makes it much easier to share code and to use code from other teams, and removes a whole area which people waste a lot of time on (bikeshedding formatting issues).
- pcwalton 9y agoBut by not having a maximum line length, everyone gets to bikeshed where to insert line breaks. Thus gofmt isn't doing its job. (Again, maybe line length doesn't matter much in Go, since lines generally don't get that long in Go, but for lots of other languages gofmt's choice would not be acceptable.)
- grey-area 9y agoFWIW, I haven't noticed this being a problem in Go code. Perhaps in other languages it's more important.
- littlestymaar 9y ago> and removes a whole area which people waste a lot of time on (bikeshedding formatting issues). Interestingly enough, I've never seen people bikeshed about code formating in a project using a style formater even if it is configurable. But everytime Go is talked about here on HN, there are many people complaining about gofmt not being configurable …
- pcwalton 9y agoLong lines are annoying in practice! Maybe not in Go, where the language tends not to encourage long lines, but in lots of other languages, having to scroll horizontally is a huge distraction to understanding code.