Live data from Hacker News

Facebook Go Libraries

github.com

21–30 of 98 posts

Re: Facebook Go Libraries

#21
post #4
post #2

OT but I think GitHub should show tabs as 4 columns. I find Go code is hard to read with all this whitespace.

Or better, we should save source code files replacing tabs with spaces. That's the best practice that makes everybody happy.

The Go team has made the decision that the language supports tabs for indentation, and it’s enforced by `go fmt`.

Re: Facebook Go Libraries

#22
post #10

Earlier quoted context omitted.

Sorry, changed "spaces" to "columns".

... and the only reason for it to be four columns is that you personally find it hard to read, or do you have another, more compelling argument against using 8 column tabs?

I'm kind of surprised that 8 column tabs is even being discussed, I thought 2 or 4 were the normal values?

Re: Facebook Go Libraries

#23
post #4

Earlier quoted context omitted.

Or better, we should save source code files replacing tabs with spaces. That's the best practice that makes everybody happy.

Go uses tabs. That's the law. It's in the documentation. Groups of spaces and tabs are semantically different. Tabs mean indentation. Spaces mean spaces.

Spaces are tolerated, but the usage of tabs is very encouraged.

Re: Facebook Go Libraries

#24
post #3

Looks more like Naitik Shah's open-source libraries.

These were all developed on the Parse team. Naitik is a huge contributor :) I believe we're the only ones doing using Go in production at Facebook. Join us! https://parse.com/about#jobs

Nice. Thanks for open sourcing these libs :)

Re: Facebook Go Libraries

#25
post #2

OT but I think GitHub should show tabs as 4 columns. I find Go code is hard to read with all this whitespace.

Actually, you can configure GitHub to do that. Just add ?ts=TABSIZE to the url. For example:

https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpc... (tab size 2)

https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpc... (tab size 4)

https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpc... (tab size 12, seems to be the maximum)

Unfortunately, there seems to be no such entry in the account settings. I'd love to set this value once and for all, or maybe once per file suffix (2 spaces for stuff.xml, 4 spaces for stuff.go).

Re: Facebook Go Libraries

#27
post #4

Earlier quoted context omitted.

Or better, we should save source code files replacing tabs with spaces. That's the best practice that makes everybody happy.

The Go team has made the decision that the language supports tabs for indentation, and it’s enforced by `go fmt`.

While this is clearly the wrong decision, one has to applaud the Go team for building `go fmt` and thus putting and end to unproductive discussions about formatting. (Although it would have been nice if `go fmt` didn't change code semantics.)

Re: Facebook Go Libraries

#28
post #12
post #3

Looks more like Naitik Shah's open-source libraries.

I wonder why these aren't under the main facebook account ( https://github.com/facebook ) o_O?

Better organization? Once you start to have more than a few pages of projects on a single group it starts to get very difficult to find them on GitHub unless you know exactly what you're looking for.

Re: Facebook Go Libraries

#29

Earlier quoted context omitted.

The Go team has made the decision that the language supports tabs for indentation, and it’s enforced by `go fmt`.

While this is clearly the wrong decision, one has to applaud the Go team for building `go fmt` and thus putting and end to unproductive discussions about formatting. (Although it would have been nice if `go fmt` didn't change code semantics.)

I'm relatively new to Go, and like you I wholeheartedly agree with the idea of solving formatting once and being done with it (and as an aside, I agree that tabs are the wrong decision).

It was my impression that gofmt was essentially a pretty printer. Can you point to examples where it changes semantics?

Re: Facebook Go Libraries

#30

Earlier quoted context omitted.

We are talking about computer semantics which exist in a discretized world, not english language semantics. By your logic, the word integer would be any number not a fraction or decimal down to negative infinity up unto positive infinity. There is no concept of infinity on a computer. Anyways, that's besides the point, and I think you missed the meaning behind my comment. The reason why a tab space cannot semanticall…

I get what you mean but a tab is purposely meaningless and unqualified. It means 1 indent, not 8 spaces, 3 bananas or one tree. It is a unit. How the user displays that is up to them.

This. Absolutely this.

I used to hate tabs and want 2 spaces only, until I started working with other developers. Then suddenly tabs made sense, especially when you've got IDEs coercing every edited file to a person's indentation standard. Standardize on the tab and the pain goes away.

Post reply on HN