在某处是否有标准的 Google Go 编码约定文档来设置在 Go 源代码中缩进时首选制表符还是空格?
官方建议是什么?
最佳答案
官方建议使用
格式化你的代码go fmt
或者直接使用 gofmt 命令
gofmt -w .
您可以阅读更多信息 here在 golang.org 博客上,或来自 Effective go文件:
Indentation
We use tabs for indentation and gofmt emits them by default. Use spaces only if you must.
https://stackoverflow.com/questions/19094704/