News for hackers. Stuff that matters.
Re:Gofmt No Longer Allows Spaces. Tabs Only by Zarel on Thursday June 19, 2014 @02:20AM (#7914721)
My project, Pokémon Showdown (https://github.com/Zarel/Pokemon-Showdown) uses tabs, although it's not for any religious reasons, it's just what I was used to when I created the project. I suggested changing to spaces when I learned they were more popular, but my most opinionated coder preferred tabs so I kept it at tabs.

Tabs and spaces both have their respective advantages and disadvantages.

Advantages of tabs:

- you can choose your indentation width in most editors, so coders don't have to agree on indentation width (this is really the only major advantage)

- most very-basic editors that can't be configured, such as Notepad or the command-line directly, will default to having the tab key insert a tab character, which is easier to press than space N times (it's rare to edit code in such cases, though)

- slightly smaller file-size, although this is pretty irrelevant in modern times

Advantages of spaces:

- certain editors are dumb and will mangle tabs in various ways (for instance, converting "3 tabs for indentation, 9 spaces for alignment" into 5 tabs and 1 space)

- most file viewers that won't let you configure tab width (for instance, browsers, which is relevant to viewing code on GitHub) will have tab width set to 8 spaces, which is very awkward

- avoids the problem of some people accidentally using tab for alignment and then having alignment be messed up when coders have different tab width settings

- certain text fields, such as browser text boxes, will have the tab key focus the next input field instead of inserting a tab character, which makes inserting tab characters difficult sometimes (it's rare to edit code in such cases, though)

Re:Gofmt No Longer Allows Spaces. Tabs Only by robin_reala on Thursday June 19, 2014 @02:33AM (#7914745)
You can style tab width in CSS though. If you want GitHub to have smaller tabs add tab-size: 2; to an appropriate selection in your site-specific CSS. I’m sure there are extensions that will do this for you. More info: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size