gofmt documentation says: Gofmt formats Go programs. It uses tabs (*width = 8*) for indentation and > blanks for alignment. >
https://golang.org/cmd/gofmt/ Just curious, any reason why it needs to specify the tab width = 8? Should that be removed if it's not relevant? Thanks! On Sunday, March 19, 2017 at 2:36:06 PM UTC-7, Rob 'Commander' Pike wrote: > > How wide should the indentation be? 2 spaces? 4? 8? Something else? > > By making the indent be a tab, you get to decide the answer to that > question and everyone will see code indented as wide (or not) as they > prefer. > > In short, this is what the tab character is for. > > -rob > > > On Sun, Mar 19, 2017 at 1:50 PM, Carl <carl...@gmail.com <javascript:>> > wrote: > >> Hi, >> >> This is a question to whoever decided that go will use tabs - team or >> person: >> >> Could you please explain your reasoning behind the decision? >> >> So far, all my googling has just turned up the what and not the why: >> >> States that tabs are to be used: >> cmd/gofmt: remove -tabs and -tabwidth flags >> <https://github.com/golang/go/issues/7101> >> Command gofmt <https://golang.org/cmd/gofmt/> >> >> Asks the question, but quickly gets off topic without answering it: >> Why does go fmt use an 8 space indent >> <https://groups.google.com/forum/#!topic/golang-nuts/93t0LWvHrKM> >> >> So my question is why were tabs chosen? >> I have no preference for tabs vs anything else, but I do respect the go >> team and the language designers and would really like to know the thinking >> behind the decision. >> >> Cheers, >> Carl >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.