-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
Add option to gofmt and goimports to use spaces instead of tabs #16256
Comments
The point of gofmt is to have a single style that everybody uses. That includes the choice of using tabs over spaces. It doesn't have to be your – or anyone's – favourite style; just the style that is used by everyone. gofmt used to have a flag to use spaces, but that flag was removed for precisely that reason. The output of the current gofmt is what your code should look like, no ifs or buts. |
Ah.. I have forgotten about this one. You're right. |
"The output of the current gofmt is what your code should look like, no ifs or buts." My code should look exactly the way I want it. I don't want tabs. I want spaces. My boss wants spaces. My company wants spaces. There are no unbroken go formatting tools I can find. |
You can write your own https://github.com/golang/go/blob/master/src/go/format/format.go I advise you not to. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?I have (I presume many people do as well)
goimport
running on each save of my.go
files in vim.Normally I use spaces in all my projects but after using
goimport
orgofmt
I receive my files tabified.It would be handy if it was possible to run
goimports
orgofmt
with flags like--usetab=true
or something similar which would allow the alternate behavior of using spaces/tabs.I believe it's fairly easy to implement in e.g.
goimports
- https://github.com/golang/tools/blob/master/cmd/goimports/goimports.goHere is a connected issue in vim-go project fatih/vim-go#5
The text was updated successfully, but these errors were encountered: