added editorconfig#27490
Conversation
|
Why not but pretty much all Go editors are "wired" to gofmt (on save) and/or should be (otherwise the build fail here anyway), so it's more a nice-to-have than a requirement. |
|
@vdemeester yeap, but there are also shell scripts and other kinds of files... I thought it would be useful to have them all under the same kind of format rules... |
|
/cc @tianon too 👼 |
|
IMO what is more valuable is a tool to enforce style as a git hook. I use http://pre-commit.com/ with https://gist.github.com/dnephin/c7776ecb5cdcf02eb1a6 to ensure that formatting is correct. If we're going to add this, it's probably more appropriate under |
|
I'm wondering if this falls in the same category as https://github.com/docker/docker/blob/389d5cde7b5474cd33d251aadc96be1f0bdbc711/.gitignore#L2-L3 |
|
True, we don't need to add it to |
|
Yeah, I agree -- this is useful information, and it's nice to see folks trying to standardize the way it's communicated, but I don't think the standard is firm enough yet that committing this at the top-level is warranted (perhaps more prudent once/if more editors start supporting this file out-of-the-box or if it becomes more common). |
|
@tianon @thaJeztah @justincormack @vdemeester Done, what do you guys think? |
.gitignore
Outdated
There was a problem hiding this comment.
Can you move this up, to keep the list in alphabetical order?
contrib/editorconfig
Outdated
There was a problem hiding this comment.
Actually, just noticing this; should this be limited to .go files? We use spaces for Markdown (.md)
There was a problem hiding this comment.
@thaJeztah Just added the missing [*.md] section.
There was a problem hiding this comment.
We do use tab for shell script though 👼, I think it's good as is. *.md is handled down 😝
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
contrib/editorconfig
Outdated
There was a problem hiding this comment.
We do use tab for shell script though 👼, I think it's good as is. *.md is handled down 😝
|
LGTM 👍 |
|
Thanks 👍 |
|
I just learned something that changed my opinion on this. github actually supports So if we set Viewing code and diffs will show 4 space tabs instead of 8 space tabs. I would be in favor of moving this out of contrib and back into the root of the repo so that we can have nicer looking code and diffs on github. |
|
@dnephin that's nice! Is it only indent size that's taken into account, no other "side effects"? |
|
I'm not sure, there doesn't seem to be much information out there about it. http://stackoverflow.com/a/33899831/444646 suggests that they never officially announced the support. I suspect it does support any options that make sense from the UI. Maybe they apply to the in-browser editor as well. |
|
Honestly, I kinda like that GitHub shows tabs at 8 spaces because it makes it much more obvious when someone screws it up in a PR because the 4-real-space-indents don't line up properly. 😇 |
|
Oh, you've got a point, it has helped me as well (if only GitHub had a |
|
Shouldn't we have automated style checks for that instead of relying on a human to notice it? http://pre-commit.com/ with https://gist.github.com/dnephin/c7776ecb5cdcf02eb1a6 is a great option. |
|
That would be good, however, I can imagine there's combinations that are harder to validate strictly |
Added
.editorconfigfile, so it's easier to avoid mistakes (like spaces vs tabs, etc).