patterngoCritical
Indentation in Go: tabs or spaces?
Viewed 0 times
indentationtabsspaces
Problem
Is there a standard Google Go coding conventions document somewhere that sets whether tabs or spaces are preferred for indentation in Go source code?
What is the official recommendation, if any?
What is the official recommendation, if any?
Solution
The official recommendation is formatting your code with
or using the gofmt command directly
You can read more about it here on the go.dev blog, or from the Effective go document:
Indentation
We use tabs for indentation and gofmt emits them by default. Use spaces only if you must.
go fmtor using the gofmt command directly
gofmt -w .You can read more about it here on the go.dev blog, or from the Effective go document:
Indentation
We use tabs for indentation and gofmt emits them by default. Use spaces only if you must.
Context
Stack Overflow Q#19094704, score: 279
Revisions (0)
No revisions yet.