TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Gofmt No Longer Allows Spaces. Tabs Only

47 pointsby gmjosackalmost 11 years ago

9 comments

ahogealmost 11 years ago
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 未加载
divoxxalmost 11 years ago
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.
erkosealmost 11 years ago
This is the oldest most persistent argument in programming.
评论 #7914646 未加载
评论 #7914625 未加载
评论 #7914610 未加载
AYBABTMEalmost 11 years ago
And what&#x27;s great; no Go developer will notice.
评论 #7914648 未加载
gmjosackalmost 11 years ago
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 未加载
teddyhalmost 11 years ago
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_krackenalmost 11 years ago
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 未加载
maxk42almost 11 years ago
What are the pros and cons of each?
angersockalmost 11 years ago
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 未加载