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.
Gofmt No Longer Allows Spaces. Tabs Only
41–50 of 57 posts
Re: Gofmt No Longer Allows Spaces. Tabs Only
#42Who 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.
You should really try not to use the word "retarded" like this.
Re: Gofmt No Longer Allows Spaces. Tabs Only
#43I 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.
Re: Gofmt No Longer Allows Spaces. Tabs Only
#44Who 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.
Re: Gofmt No Longer Allows Spaces. Tabs Only
#45Who 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.
The annoying part is that you can't set tab width in browser (afaik), which makes it painful reading code on, say, github, and being displayed an indent as the equivalent of 8 spaces. Browsers have to fix that.
So, to answer your question : I do not use tabs, but I would gladly do if offered the possibility.
Re: Gofmt No Longer Allows Spaces. Tabs Only
#46Earlier 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.
Re: Gofmt No Longer Allows Spaces. Tabs Only
#47I 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.
Browser <pre supports tabs and defaults to the value of 8 (as is standard), so that shouldn't be a problem.
Re: Gofmt No Longer Allows Spaces. Tabs Only
#48Earlier quoted context omitted.
Unsure if trolling or not. It's quite easy to have your editor represent a tab character as "n spaces" - where n is the number of spaces you find pleasing. In fact, I can't recall a serious editor where this isn't the case. What issues have you seen with regards to using tabs?
Often different editors on a project (hell, even between computers for the same user) may display the same file different ways, and you almost always end up with weird mixes of spaces/tabs when indenting things (especially if you're super picky like I can be and really, really care about things lining up). Simply having the editor expand tabs (to whatever people agreed on, usually 4 for C/C++ that I've seen) and save…
Re: Gofmt No Longer Allows Spaces. Tabs Only
#49Earlier quoted context omitted.
There is nothing wrong with mixing tabs and spaces. It works great.
Provided everyone use the same tab width :)
Re: Gofmt No Longer Allows Spaces. Tabs Only
#50Earlier quoted context omitted.
Unsure if trolling or not. It's quite easy to have your editor represent a tab character as "n spaces" - where n is the number of spaces you find pleasing. In fact, I can't recall a serious editor where this isn't the case. What issues have you seen with regards to using tabs?
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…
Which is actually the problem gofmt solves.
The desire to express your individual preference through the way code is formatted is an issue not a feature.
The code may be read, maintained and handled by many other individuals during the life of the code, and gofmt is an attempt to provide an incredibly high degree of consistency in the way that the code is formatted to improve those things.
The Go way is simplicity, readability, maintainability.
Once you accept that consistency in formatting is important and a good thing to strive for, the only question is spaces vs tabs. But spaces is a highly opinionated option as the number of spaces used for indentation has to be uniform, whereas tabs allows for each individual to configure their editing tool to permit a degree of individual preference that does not sacrifice any of the consistency.
Tabs have the advantage, please configure your editor to suit your preference and not the code.