Open robpike opened 5 years ago
See https://github.com/golang/go/issues/27818 and https://github.com/golang/go/issues/28773 for examples of where things could go if we decided Effective Go was to reflect the state of the art, a moving target.
I agree about the #28773 comments being out of place. That's not what the doc is about. It's OK to avoid worrying about things like that, and the doc will become unwieldy if it must be concerned with everything at all times.
I'm all for freezing it.
I'm less sure about starting something new and more dynamic and current. That sounds great, of course, but what form would it take? How would it be structured? Reviewed? What would it contribute beyond existing materials, like say https://gobyexample.com/?
It might be valuable to have a separate overall guide to the standard library. There's a lot of it now, a lot more than when EG was written.
Agreed. That said, what you're describing still sounds to me like Go By Example. Maybe we should focus effort there, to the extent effort is needed.
I agree with that Effective Go should not be "How to write modern, trendy, stylistic, library-aware code". But I think it's a bit of a stretch to say my suggestion of "not modifying the receiver in String()
" falls into this category -- that does seem like ineffective Go and the kind of thing that will bite someone later. (For example: "Why on earth is this Printf call modifying my sequence?!")
That said, I'd be happy for this to be frozen "like a book", however, in that case I think it should look more like a book or be packaged up somewhere else. The stuff on golang.org/doc has a very "up-to-date documentation" feel to it in my opinion (as I think it should).
@benhoyt As I said in the other issue, I would be willing to fix up the example (to avoid overwriting the receiver, at least), but not to the extent of using strings.Builder.
If the document is frozen, it will need an introductory paragraph saying so as well as links to further reading.
Yep, sounds reasonable, thanks.
Effective Go is widely linked to, has good SEO, etc. I think it’d be a pedagogical waste to consign it to be a frozen historical document. (I don’t have opinions at the moment about the specific changes being proposed.)
I mostly agree with how the scope of Effective Go shouldn't be made bigger - the page itself is already quite large, and it serves as a good basis that pretty much every Go developer should have read once.
@josharian what if Effective Go linked to other documents touching more specific topics? For example, we could have an "effective use of std" document, linking to it at the top of the page. I think that would still let us take advantage of existing links and SEO.
I think these documents already follow a certain path anyway; see the quote below. It would only be a matter of adding "further reading" links.
This document gives tips for writing clear, idiomatic Go code. It augments the language specification, the Tour of Go, and How to Write Go Code, all of which you should read first.
@josharian I'm not asking to delete it, just freeze it. It covers a small fraction of what people now consider best practices for writing Go code in the modern ecosystem. It focuses almost exclusively on the language itself, and in particular the language as it first appeared. I wrote it in a frenzied weekend a few days before the language was open sourced, and it's changed little since then.
I'd like to acknowledge that it hasn't aged well and supplement it rather than rewrite it.
How does "freeze" differ from "deprecate"?
I don't think it would benefit it much to significantly change its scope, but I do think the examples in it should be good. Changes should probably be fairly rare -- in most cases, there's not much language change happening to merit them. But for instance, if Effective Go predated append()
, it would be ridiculous not to update it to show current best practice. I doubt there will be many changes like this in the language's future, but if there are some, it'd be nice to have the canonical source be correct.
But it does make sense to distinguish between "new things that could possibly merit new sections or new documents" and "cases where the code or descriptions in Effective Go are probably wrong by current understanding". A preference for new documents rather than new material makes sense, but if we found actual bugs in the code, I'd think it'd be better to fix them.
I'd like to acknowledge that it hasn't aged well and supplement it rather than rewrite it.
Perhaps my take is dated, but it isn't obvious to me that it hasn't aged well. From what I see, what folks are asking for tweaks and gentle evolution, not a rewrite. Supplementing it seems good. Adding prominent links to additional docs seems good. I just don't see the value in freezing it.
I can see the appeal of not having to litigate every request to change it. And I understand the relief of never having to look again at words written many years ago. I just don't think that freezing it rather than fixing little things (like sorting in a String method) would serve the Go community well, particularly as it goes through a period of rapid growth, during which time the education of new gophers is among the greatest challenges.
How does "freeze" differ from "deprecate"?
It defers because it is still valid. @robpike has argued that certain kinds of additions do not logically belong there and proposes to create something new that will supplement Effective Go.
Change https://golang.org/cl/165597 mentions this issue: doc: sort map output in Effective Go
I'd like to acknowledge that it hasn't aged well and supplement it rather than rewrite it.
Perhaps my take is dated, but it isn't obvious to me that it hasn't aged well. I just don't think that freezing it rather than fixing little things (like sorting in a String method) would serve the Go community well, particularly as it goes through a period of rapid growth, during which time the education of new gophers is among the greatest challenges.
I'm here because I was looking for a specific issue I have and wanted to read about in Effective Go. Having it so prominently placed at the golang.org website implies a relevance, but reading here its a mostly years old document not reflecting current thinking of effective usage of Go, makes me feel a bit sad on the part where I then should look for such a document when not from the projects main documentation page.
I understand that it might be too much to get a revised edition out, but then better off remove it, or clearly mention its disconnected state related to the real world of Go.
Like @josharian said, I too can't distinguish which parts are outdated and which are not. It might be not even easy for someone who is in the loop of things, but how would new Gophers even get that message then?
Please don't freeze Effective Go, it was my main intro to Go, and it should be kept up to date, a lot of people prefer reading something like that rather than books and random youtube videos.
If this does get frozen, it seems like Go Code Review Comments ought to be more self-contained, especially when it refers to obsolete parts of Effective Go.
Change https://golang.org/cl/380634 mentions this issue: content/doc: add an explanatory preamble to Effective Go
Been a go programmer for the last 2 years and the effective_go has helped a lot. The doc definitely went very lengthy and was not capable of exhibiting the depth of go language. Considering the go ecosystem and its effect on today's tech fabric, a new more structured doc is the demand of the hour.
Looking at EG and just noticed the preamble added back in January 2022. It says that "there are no plans to update it", which leaves me with some questions:
@joecotton-wk A Tour of Go I believe is already more up to date than Effective Go and it also suggests a few books about advanced concurrency in the end
For beginners of the Go, the Effect Go documentation is very helpful, allowing me to better intuitively understand the features of the Go . It is a very good learning material, but it is a pity that the update has been not undate.
As a big fan of Rob's written and spoken style[^1], I do appreciate the proposal. I wish there could be footnotes implemented in some non-intrusive way so that readers could enable or disable them to switch between the original reading experience and more updated one. EG could serve also as a hub with links to other resources, when explicitly enabled.
We have just updated our project to 1.18 today. Exciting times, yet my old 1.0 code compiles just fine. I think EG is a proof of the great design and execution. Cheers!
[^1]: I've seen all Rob's talks, some of them three times or more. I am bit starved for last couple of years, there are not many new public recordings, I am crossing my fingers for new content. ;-)
I think it would be beneficial to annotate the document in places where @robpike feels the need. if the original author does it, the document won't lose voice. and this annotated EG should be available under different URL leaving the original unchanged.
There have been a number of suggestions to change the code inside Effective Go lately. For instance, the comments in https://github.com/golang/go/issues/28773 suggest adding an example that uses strings.Builder. But in fact there are almost no mentions of library functions in the document, so starting with strings.Builder doesn't make much sense.
I may be totally alone here, but I think of the current document called "Effective Go" (EG) as a bit of a time capsule, a published book if you will.
I think it should be pretty much left alone. The continuing churn of advice and recommendations and cargo culting should not be developed there. I think even though it is old it does a fine job of saying how to write effective Go code. How to write modern, trendy, stylistic, library-aware code is different question.
I think there should be a new document that talks about the libraries (almost totally absent from EG), style (nearly ditto), "best practices" such as the thing about returning concrete types, not interfaces (which requires so many caveats I fail to understand why it's a rule), etc. I fear that if you try to incorporate that into EG several things will happen: It will become much longer; it will be changing constantly; many people will add to it; and it will lose the writing style it has, which is almost entirely mine, and therefore in my voice.
Let's freeze it and start something new and more dynamic and more current.