11 ms·
Facebook Go Libraries
- Kiro 12y agoOT but I think GitHub should show tabs as 4 columns. I find Go code is hard to read with all this whitespace.
- tuxone 12y agoOr better, we should save source code files replacing tabs with spaces. That's the best practice that makes everybody happy.
- custardcream 12y agoGo 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.
- tuxone 12y agoMy apologies, thank you for the clarification.
- treehau5 12y ago>Tabs mean indentation. Sorry but this is false. The only thing a tab means, is tab. Please provide your reasoning for the down voting. Thank you.
- custardcream 12y agoThe dictionary in front of me disagrees: "A key on a computer keyboard that, when pressed, inserts a special ASCII character used for formatting text, as in indenting a line or block of text." Actually going back it means tabulation which was an early form of alignment of tables on typewriters. The tab key advanced the carriage to the next tabulation point. It was repurposed as a way of indenting code later and it has become an additional definition of that fact. (I'm old enough to have owned a typewriter, a nice Selectric one as well ;-)
- treehau5 12y agoWe 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 semantically mean indentation in our world, is because nobody can agree on what that indentation should be. Since you are old enough to have owned a typewriter, maybe you are old enough to remember that by legacy, a tab was equivalent to exactly 8 spaces, and much of our software that runs the internet makes that assumption. Now however, people are saying "use tab to mean indent and everyone can have their way" To quote mikko, "There is no style guide or coding conventions saying that the tab character should be the indent. This assumption is easy to make because it allows you to stick your head into the sand, ignore the surrounding world and by singing “let the users pick their own tab width” mantra." Again, this wasn't to start a tab vs spaces war for go, and why go chose tabs. It's fine to make a choice, but it was your second statement that provoked my comment.
- custardcream 12y agoI 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.
- trebor 12y agoThis. 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.
- munificent 12y ago> There is no concept of infinity on a computer. Sure there is: http://en.wikipedia.org/wiki/IEEE_754-1985#Positive_and_negative_infinity http://en.wikipedia.org/wiki/IEEE_754-1985#Positive_and_nega...
- Artemis2 12y agoSpaces are tolerated, but the usage of tabs is very encouraged.
- deleted 12y ago[deleted]
- halostatue 12y agoThe Go team has made the decision that the language supports tabs for indentation, and it’s enforced by `go fmt`.
- andrewprock 12y agoWhile 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.)
- couchand 12y agoI'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?
- andrewprock 12y agogo fmt will reorder your imports, which means that if there is an import ordering dependency, it will either be exposed (or hidden) by go fmt.
- ominous_prime 12y agoyou should never have an import order dependency, since initialization order is unspecified.
- andrewprock 12y agoShoulda woulda coulda: https://bugs.launchpad.net/gocheck/+bug/1178806 https://bugs.launchpad.net/gocheck/+bug/1178806
- 12y ago
- _ak 12y agoWhy? n spaces encode a specific preference for indentation, while tabs just represent a level of indentation. How many columns these actually are is entirely up to personal preference and editor configuration. That's why tabs are always superior for indentation.
- andrewprock 12y agoIt's actually quite a bit more subtle than that. Even `go fmt` uses tabs to format indentation, but uses spaces to format alignment. This is distinct from mechanical typewriters which used variably sized tab-stops to handle tab alignment.
- boomlinde 12y agoNo, it should show it as tabs, because that's what it is. Ideally, it should show it as 8 column tabs, as that is what gofmt assumes by default.
- Kiro 12y agoSorry, changed "spaces" to "columns".
- boomlinde 12y ago... 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?
- possibilistic 12y agoPersonally, I find 8 columns to be an incredible waste of horizontal space. I frequently place editor windows/panes side by side, and using 8 columns or spaces wastes valuable screen real estate. But this isn't just a reaction rooted in practicality. To me, this looks and feels absurd. It kind of hurts to read. Again, this is just my personal take. I prefer scope indentation of any kind to render as 4 spaces, but I'm okay with 2 as well.
- Dewie 12y agoI agree. For me, I want enough indentation to make the structure obvious. 8 columns is way overkill in that regard.
- Kiro 12y ago> and the only reason for it to be four columns is that you personally find it hard to read Yes, it was just a personal opinion.
- boomlinde 12y ago
- vog 12y agoActually, you can configure GitHub to do that. Just add ?ts=TABSIZE to the url. For example: https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpcontrol.go?ts=2 https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpc... (tab size 2) https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpcontrol.go?ts=4 https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpc... (tab size 4) https://github.com/facebookgo/httpcontrol/blob/e815eb2/httpcontrol.go?ts=12 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).
- shurcooL 12y agoI, too, would like to see an entry to set my preference for my account. I prefer tabs of size 4. In fact, this is the only remaining issue I have left at https://shurcool-legacy.github.io/bettertogether/ https://shurcool-legacy.github.io/bettertogether/.
- nahname 12y agoLooks more like Naitik Shah's open-source libraries.
- akavel 12y agoHe seems the main committer there, indeed... but "Naitik Shah's open-source libraries" seem to be present already at: https://github.com/daaku?tab=repositories https://github.com/daaku?tab=repositories ... so what is the "facebookgo" thing then? edit: the files have "Copyright Facebook, Inc." anyway
- Shish2k 12y agoI wonder why these aren't under the main facebook account ( https://github.com/facebook https://github.com/facebook ) o_O?
- couchand 12y agoBetter 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.
- twotwotwo 12y agoIt gives them more freedom in package names. It's nice when a package name is the same as the last element of the URL, and that URL's reasonably short. And you repeat the package name whenever you use an identifier from the package, so it's good if it's 1) short, and 2) if possible makes the full identifier read nicely à la counting.Reader. With their own GitHub username, they can just use whatever word they want for the package name (tool, counting, stack, subset, grace, inject) without risking a collision with other Facebook projects.
- csmajorfive 12y agoThese 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 https://parse.com/about#jobs
- tptacek 12y agoThis is neat. I like that everything's packaged independently like this. httpcontrol looks particularly handy: https://github.com/facebookgo/httpcontrol https://github.com/facebookgo/httpcontrol
- deleted 12y ago[deleted]
- chubot 12y agoIs there any repo of Facebook D code? I thought they were making an investment in D. But this is a bit surprising because it seems possible that they use more Go than D.
- Dewie 12y agoWhy surprising? I guess they use many different languages. And Go and D are probably sufficiently different to have distinct uses for them.
- manacit 12y agoThis is not a lot of Go - it's mostly small contained packages for doing useful things. It was also written by the Parse team, who are the only people using Go at FB in production[0]. 0: https://news.ycombinator.com/item?id=8601850 https://news.ycombinator.com/item?id=8601850
- zeebeee 12y agoI have no idea how to evaluate this, or even tell what it is. Could someone help me out? I see that it's a bunch of packages, under the heading of "Facebook Go". I assume this is something related to Google's Golang? I click on "tool" ("Go library that wraps the go tool"). This has a README that points to a documentation link. And that documentation says things like, "Build the Command and return the path to the binary." So, I guess we're talking about some kind of compiler here? A Golang compiler? How to I get it, how do I use it, and what -- if anything -- does this whole mess have to do with Facebook?
- chc 12y agoThe name of the language is Go, not Golang. This is a collection of tools and libraries for Go that Facebook has developed. I don't see any compiler, though one of them wraps the Go tool that is used to compile Go programs.
- codemac 12y agoI've been working with go for the past year, and let me tell you - golang is king when it comes to google's own search engine queries. You're right it's not the proper name that the go language team at google assigned, but it's certainly the colloquial (and notably more unique) one.
- chc 12y agoI don't see that it is the colloquial name of the language even if people sometimes search for it. In conversation, AFAIK it tends to be called Go. For example, look through the golang-nuts mailing list and count how many people say "Go" versus "Golang" when not referring to the website or mailing list.
- unepipe 12y agoHave you tried debugging something and search for for "go" rather than "golang"? You're both correct here: the name of the language is Go, and when searching google for help with an error or something, it's best to search for golang rather than go, or you'll be wading through a bunch of unrelated pages.
- jvehent 12y agoThis is the first time I see a patent file in an open source project [1] and now I know I won't use this until my lawiers take a look at it. Sad world... [1] https://github.com/facebookgo/runcmd/blob/master/patents https://github.com/facebookgo/runcmd/blob/master/patents
- deleted 12y ago[deleted]
- autarch 12y agoWell, if you read the file you'd see that it's a grant of rights to use this software regardless of any patents Facebook has that may apply to said software. It looks to be more or less the same as the relevant clause in the Apache 2.0 license that says "you can use our patents but if you sue us your right to use this software is automatically revoked."
- jvehent 12y ago...and the Apache 2.0 license belongs to a short list of licenses that have been extensively reviewed and can be trusted. Every time someone comes up with a new license, the review work must be redone to ensure it respects the philosophy of Open Source. Which is why I prefer project published under well-known licenses (GPL2/3, LGPL, Apache, Mozilla, BSD, ...).
- kyrra 12y agoThe package in question is licensed under BSD 3-clause license. I'm guessing the patent file is included as well to cover their bases.
- DannyBee 12y agoBSD is generally viewed to have an implied patent license. The patent file is usually there to give you a different set of rights than you would have gotten, be it good or bad (and i've seen both :P)
- stesch 12y agoWow, Facebook sure uses a lot of languages. PHP, Hack, C++, Erlang, OCaml, D, Go, JavaScript, …
- nuclear_eclipse 12y ago... Python, ...