Answer the question
In order to leave comments, you need to log in
Why is Go indenting 8 characters?
What does this mean for code readability?
Answer the question
In order to leave comments, you need to log in
There are not 8 characters, there is tab. You can set the tab size in your text editor to the number of characters you need.
It seems to me that the length of the indents is a very individual thing, and it is better to see how it is more convenient for you personally. Java has 4 character indentation and Scala 2 character indentation, but I've seen commands that do the opposite - they use 4 characters in Scala code, while Java uses 2. I think it's the same with Go is the same parsley - it seems to the authors of the language that this only increases readability, but in fact, half of Go users who are used to 4-character indentation will feel that the code is spreading too much.
If there were 2 spaces or 7 spaces - you would ask exactly the same question.
The author of the go fmt utility, which does this "standard" formatting, is not happy with the format itself. He personally prefers the other.
But the author of go fmt agreed with his fellow Go authors that the format should be the same all over the world.
What was accepted, such was accepted.
UPD:
go fmt does not insert spaces, but tabs.
thus, the display depends only on your text editor , and not on "harmful" Go.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question