Live data from Hacker News

Facebook Go Libraries

github.com

81–90 of 98 posts

Re: Facebook Go Libraries

#81

Earlier quoted context omitted.

I don't think gofmt assumes any width for tabs. It, prints `\t` for indentation, and that's all.

It has the -tabwidth option, defaulting to 8. I have yet to figure out what it's used for, but presumably there is some case where it is used for alignment.

> It has the -tabwidth option, defaulting to 8

It was only used when you invoked the other option to use spaces instead of tabs. Both options are now removed. gofmt doesn't care how wide your tabstops are.

Re: Facebook Go Libraries

#82
post #34

Earlier quoted context omitted.

Wait, why is it clearly the wrong decision? I think using tabs for indentation is great. I agree gofmt is amazing, and for any language I'd happily trade whatever my personal style is for consistency and and gofmt-like tool. Can gofmt really change semantics? I would assume that's a bug?

It not a particularly interesting discussion to have. The short of it is, if you only ever use one tool (or family of tools) to look at code (say an IDE), then tabs are not unreasonable. Once you start using multiple families of tools on multiple machines, now you have to maintain T*M tab configurations, which is awful. The "standard" alternative (e.g. the google c++ style guide) advises 2-space indentation with 80 c…

I think this stuff is actually pretty interesting, it's programmer tools UX!

I use emacs and various command line tools. Tabs don't give me problems. FWIW.

Re: Facebook Go Libraries

#83

Earlier quoted context omitted.

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.)

That's only if the developers use go fmt though. The only place I've worked at that used Go didn't use go fmt.

That's craziness. Why wouldn't you?

Re: Facebook Go Libraries

#84
post #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, 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/.

Re: Facebook Go Libraries

#86

Earlier quoted context omitted.

go 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.

I'm just going to say whoever is downvoting this is a jerk. This comment is actually correct. Whether or not it reflects the way you believe things should happen, this is an accurate description of how things do happen (I assume, based on the other comments, I don't actually know myself).

Yes and no. `gofmt` is a tool to make your code follow certain style guidelines, and the ordering of imports is part of those guidelines. You are always free to ignore the guidelines, but then don't complain about the tool which is created to enforce them.

It is also incorrect to rely on the order of import initialization at all, because it's undefined, implementation specific and may change.

Re: Facebook Go Libraries

#87

Earlier quoted context omitted.

I'm just going to say whoever is downvoting this is a jerk. This comment is actually correct. Whether or not it reflects the way you believe things should happen, this is an accurate description of how things do happen (I assume, based on the other comments, I don't actually know myself).

Yes and no. `gofmt` is a tool to make your code follow certain style guidelines, and the ordering of imports is part of those guidelines. You are always free to ignore the guidelines, but then don't complain about the tool which is created to enforce them. It is also incorrect to rely on the order of import initialization at all, because it's undefined, implementation specific and may change.

So it sounds like... yes and yes. Guidelines are guidelines. If they are more than guidelines they must be enforced at the language level.

Undefined behavior is another thing. Surely, it's poor form to rely on undefined behavior. However, that doesn't mean it isn't possible for such a situation to arise. An accurate description of how that can happen doesn't deserve a downvote.

On the contrary, it's quite valuable for a newbie (like myself) to learn the facts, not just the dogma. Downvoting an accurate description of the behavior of the tool because you think the situation shouldn't arise in the first place is simply a misplaced use of a downvote.

Re: Facebook Go Libraries

#88
post #83

Earlier quoted context omitted.

That's only if the developers use go fmt though. The only place I've worked at that used Go didn't use go fmt.

That's craziness. Why wouldn't you?

"Sometimes people work faster with code formatted like they are used to" - Code Creator "Well, if we all standardize on the same style we can get used to working faster with the same format giving everyone a net win" - Me "Well we'll have to do it after... later... deadlines... shipping" - Code Creator

Re: Facebook Go Libraries

#89
post #47

Earlier quoted context omitted.

The crappy documentation is very much in line with many Go libraries, sadly. There doesn't seem to be a great culture of documentation. People often just write bare API docs without explaining why the library is useful or showing a lot of examples.

Never experienced this, godoc https://godoc.org/ is a good resource

I was complaining about exactly the docs I've found on godoc.org.

Re: Facebook Go Libraries

#90
post #46

Earlier quoted context omitted.

Well, 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."

"Well, 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." " It 100% is not the same as Apache. 1. If you challenge any fa…

I was merely trying to point out that contrary to what the OP seemed to be suggesting, this file is not a list of patents that Facebook says apply to this code, or anything else particularly nefarious.

Also, your paraphrasing leaves out the crucial bit that you only lose your rights if you sue Facebook for patent infringment. If, say, you decide to sue Facebook because you're sick of seeing the stupid Buzzfeed articles your so-called friends keep liking in your news feed, you can continue using their software.

Post reply on HN