-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/gofmt: remove -tabs and -tabwidth flags #7101
Labels
Milestone
Comments
Labels changed: added repo-main. Owner changed to @griesemer. |
I have a patch at https://golang.org/cl/50600043. I'll mail if we reach consensus. Please count my star as support. |
I'm +1 for the change. The purpose of gofmt is to put code in to the canonical Go style, which is indented with tabs. There's no reason to provide options to put it in to another style, it just serves to confuse new users. If someone wants to format Go code in to their own style, they can easily create their own tool by forking the gofmt code. |
Having the options suggests, to new users, that using them is fine and that they're still following Go style even though they're not. Not having them is more likely to get new people to adopt the correct style. The select few who are stubborn enough to ignore the style are free to go through the hassle of using their own fork of gofmt. |
Yes, because gofmt is adopted and perceived by the community as a requirement. Most people won't contribute to projects that are not gofmt'ed properly. Go programmers *love* the fact that gofmt is the defacto standard and they follow it. Usually, people that are doing something different are new to the language and too attached to their other language's standards. |
they probably won't change their mind just because this change. but I sincerely hope they change their mind at least for Go (and I know people who did) as I said in the mailing discussion, Go is a language optimized for read rather than write, and having consistent formatting is just one aspect of it. |
@Dave (comment #6) If you're referring to the go/format package, that currently only provides functionality for the canonical style (with tabs). You'd have to reimplement gofmt using other go/* packages and turn TabIndent off in go/printer. Looking at the tests for that package, it appears that it actually does not use TabIndent for the test cases. |
This issue was closed by revision 014f3dc. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: