TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Gofmt No Longer Allows Spaces. Tabs Only

47 点作者 gmjosack将近 11 年前

9 条评论

ahoge将近 11 年前
I prefer tabs (tab-size: 4), but I prefer even more if everyone follows the same conventions.<p>Dart, for example, uses 2 spaces. When I write Dart code, I use 2 spaces.<p>And that&#x27;s the end of that. As history has shown, there is absolutely no point in discussing this. There is no clear winner.
评论 #7915529 未加载
divoxx将近 11 年前
Awesome. The only thing that really matters is to have a convention, and tabs has been the accepted convention in the Go community since forever.<p>Changing go fmt to enforce the convention is simply making sure that people write code the same and frees the developers from the tireless discussion about which one is better. That alone outweigh any disadvantage of choosing one or the other.
erkose将近 11 年前
This is the oldest most persistent argument in programming.
评论 #7914646 未加载
评论 #7914625 未加载
评论 #7914610 未加载
AYBABTME将近 11 年前
And what&#x27;s great; no Go developer will notice.
评论 #7914648 未加载
gmjosack将近 11 年前
I&#x27;m personally in the spaces camp but my favorite point in favor of tabs no one has mentioned is all of the bytes you&#x27;re saving. In a large codebase you can save kilobytes to megabytes by switching from spaces to tabs. :)
评论 #7915796 未加载
teddyh将近 11 年前
The <i>right</i> way to solve all this tabs&#x2F;spaces indentation mess would be to use Elastic Tabstops¹.<p>1) <a href="http://nickgravgaard.com/elastictabstops/" rel="nofollow">http:&#x2F;&#x2F;nickgravgaard.com&#x2F;elastictabstops&#x2F;</a>
评论 #7914647 未加载
zak_mc_kracken将近 11 年前
I predict that this change will be reverted in a few months when the Go team realizes that code is read in a lot of different places, most of which never display hard tabs correctly.
评论 #7914698 未加载
评论 #7914841 未加载
maxk42将近 11 年前
What are the pros and cons of each?
angersock将近 11 年前
Who actually uses tabs instead of spaces? I&#x27;m genuinely curious--one of the first things pretty much any project I&#x27;ve ever been involved in has been the setting of tabs characters to become spaces, simply because all text editors are retarded in this regard. This is quite strange.
评论 #7914641 未加载
评论 #7914609 未加载
评论 #7914721 未加载
评论 #7914621 未加载
评论 #7914845 未加载
评论 #7914856 未加载
评论 #7914650 未加载
评论 #7914826 未加载
评论 #7914762 未加载
评论 #7914776 未加载
评论 #7916378 未加载