Live data from Hacker News

Gofmt No Longer Allows Spaces. Tabs Only

code.google.com

21–30 of 57 posts

Re: Gofmt No Longer Allows Spaces. Tabs Only

#22

Who actually uses tabs instead of spaces? I'm genuinely curious--one of the first things pretty much any project I've ever been involved in has been the setting of tabs characters to become spaces, simply because all text editors are retarded in this regard. This is quite strange.

Virtually every Go programmer does, at least.

Re: Gofmt No Longer Allows Spaces. Tabs Only

#23
post #11

Earlier quoted context omitted.

No, Fitz is not advocating tabs over spaces in coding. He is saying gofmt loses a large part of its purpose if it does not enforce a particular style, and the Go devs happen to prefer tabs. It sounds like he's fine w/ anyone using a tool to format by spaces. That said, this is quite un-newsworthy.

I'd say it's newsworthy to large Go shops that use spaces with gofmt and now have to change indentation in their repos. This isn't insignificant. Also it requires additional flags for things like blame/diff to ignore whitespace changes.

no such large go shops exist.

Re: Gofmt No Longer Allows Spaces. Tabs Only

#25
post #14

Earlier quoted context omitted.

Grabbing some Clojure code because it's nearest to hand. Look here: https://github.com/clojure/clojure/blob/master/src/clj/cloju... I want the bindings being declared within that let to line up with one another. the first one immediately follows "(let [" so I need the rest to be indented six characters past where the let was originally indented. Six, not N times whatever the tab width happens to be in whichever edito…

The way people solve that is tabs for indentation and spaces for alignment. In my opinion this is a terrible compromise as mixing tabs and spaces is sacrilegious.

There is nothing wrong with mixing tabs and spaces. It works great.

Re: Gofmt No Longer Allows Spaces. Tabs Only

#26
post #23

Earlier quoted context omitted.

I'd say it's newsworthy to large Go shops that use spaces with gofmt and now have to change indentation in their repos. This isn't insignificant. Also it requires additional flags for things like blame/diff to ignore whitespace changes.

no such large go shops exist.

Is it that unbelievable to you that a company that previously used other languages with spaces for indentation would desire to have a consistent indentation policy, especially considering that up until now the tooling supported such desires?

Re: Gofmt No Longer Allows Spaces. Tabs Only

#28

Earlier quoted context omitted.

The way people solve that is tabs for indentation and spaces for alignment. In my opinion this is a terrible compromise as mixing tabs and spaces is sacrilegious.

There is nothing wrong with mixing tabs and spaces. It works great.

Until Python. Then it doesn't.

Re: Gofmt No Longer Allows Spaces. Tabs Only

#29

I predict that this change will be reverted in a few months when the Go team realizes that code is read in a lot of different places, most of which never display hard tabs correctly.

I've read a lot of Go code in many different places during the last years, all with tabs, and I did not have any problems.
Post reply on HN