Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Go doesn't require tabs. Tabs and spaces work just like C, they separate tokens but are not otherwise relevant. It's not like Python where they indicate indentation level.

The only whitespace character that works differently than C is the newline. In Go, newlines (usually) separate statements, like a semicolon does in C.



From the topmost section:

We use tabs for indentation and gofmt emits them by default. Use spaces only if you must


Code formatting conformity is pretty big in the Go culture.

Go the language doesn't care if you use tabs or spaces, Go the community would prefer you to use tabs so when your Go code is loaded in whatever random editor any member of the community uses there are no surprises.


I only care that it was formatted with gofmt.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: