When I read codes from https://cs.opensource.google/go, indents are 2 spaces and when using gofmt indents are 2 tabs. Why?
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3b43a2be-8001-4f53-a952-417b6a909bd9n%40googlegroups.com.
On Tue, Sep 13, 2022 at 3:55 PM Moein Halvaei <moein...@gmail.com> wrote:When I read codes from https://cs.opensource.google/go, indents are 2 spaces and when using gofmt indents are 2 tabs. Why?Google's Codesearch defaults to matching Google's C++ style guide rather than Go's recommended style: https://google.github.io/styleguide/cppguide.html#Spaces_vs._TabsTo be clear: gofmt uses an 8-spaces per tab, not two tabs.
----
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3b43a2be-8001-4f53-a952-417b6a909bd9n%40googlegroups.com.
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CANrC0BgCHM_m2nkAjkqnLDP02-FfYFtOyRv9SW8SAup4NHp1UA%40mail.gmail.com.
On Tue, Sep 13, 2022 at 10:46 PM David Finkel <david....@gmail.com> wrote:On Tue, Sep 13, 2022 at 3:55 PM Moein Halvaei <moein...@gmail.com> wrote:When I read codes from https://cs.opensource.google/go, indents are 2 spaces and when using gofmt indents are 2 tabs. Why?Google's Codesearch defaults to matching Google's C++ style guide rather than Go's recommended style: https://google.github.io/styleguide/cppguide.html#Spaces_vs._TabsTo be clear: gofmt uses an 8-spaces per tab, not two tabs.gofmt doesn't determine how many spaces are tab stops aligned to at all. That's a property of your editor, IDE or code browser and usually configurable. That's part of the appeal of using tabs for indentation and why spaces are better for alignment.