-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: document the "Deprecated" convention #10909
Comments
In go1.5.html yes, in Effective Go, no. |
But go1.5.html is a changelog. We should document the convention itself On 19 May 2015 at 15:57, Rob Pike notifications@github.com wrote:
|
Seems like a better place. Or maybe we need a general conventions, or document conventions, document. |
I like the idea of a document conventions docs.
|
What is the final convention that was decided on? It's really hard to conclusively parse it out of the linked thread even after reading all messages. Edit: I think the answer lies in this message:
|
Please see https://golang.org/cl/10188 for examples. There are three forms:
|
I have a question. Would it be better or worse if "Deprecated:" was made mandatory to be the first word of a doc comment for a deprecated field/variable/func/method? That seems like the first thing the documentation should convey, and having it be something other than the first word means a user is possibly going to spend some time reading/learning about a new method before realizing that it's already deprecated. Consider the 3rd example above: // Do fires the missiles.
//
// Deprecated: missiles supplies depleted. Do is a no-op now.
func Do() error A user would need to read all of "Do fires the missiles." or however long that comment is, while spending energy understanding the functionality, only then to hopefully get to the next paragraph that says it's deprecated and they should be reading about something else instead. I had this thought on my mind and just wanted to share it. |
A better real-world example where the problem is worse can be seen here: // StringSlicePtr converts a slice of strings to a slice of pointers
// to NUL-terminated byte arrays. If any string contains a NUL byte
// this function panics instead of returning an error.
//
// Deprecated: Use SlicePtrFromStrings instead.
func StringSlicePtr(ss []string) []*byte { |
I don't really like the idea of putting the word "Deprecated" first. With But perhaps godoc should be made to hide or collapse the definitions of On 12 October 2015 at 11:21, Dmitri Shuralyov notifications@github.com
|
I agree, that should be preserved. The way I imagined it would be: // Deprecated: Use SlicePtrFromStrings instead.
//
// StringSlicePtr converts a slice of strings to a slice of pointers
// to NUL-terminated byte arrays. If any string contains a NUL byte
// this function panics instead of returning an error.
func StringSlicePtr(ss []string) []*byte {
Do you still dislike it even given the above? If so, that's completely okay. I just wanted to mention minor idea so that it would be considered.
Perhaps it (and many other Go editors/tools) can/should do that. But I think that's an orthogonal optional enhancement. I realize requiring "Deprecated:" to come first will require an update to |
That does seem reasonable. I don't have strong feelings one way or another. |
I'm sorry, but breaking the rules about how doc comments begin is off the table. |
No problem, thanks for considering it! In that case, existing tools can choose to detect deprecated methods and visually warn users about that, if they deem that to be an improvement/worth doing. |
CL https://golang.org/cl/18956 mentions this issue. |
Have you been considering emphasizing the deprecated stuff in godoc ever since? As an |
Now that we have QueryWithOptions, TimeV isn't necessary.
I created https://golang.org/wiki/Deprecated to have something to link to. |
…godoc post Fixes golang/go#10909 Change-Id: Ie2553bc2f6983cbcaf7398366c21dc175e1f5453 Reviewed-on: https://go-review.googlesource.com/18956 Reviewed-by: Rob Pike <r@golang.org> X-Blog-Commit: 257114af91a0defb1fc2c16c7f4ae2429b8a4e0f
…godoc post Fixes golang/go#10909 Change-Id: Ie2553bc2f6983cbcaf7398366c21dc175e1f5453 Reviewed-on: https://go-review.googlesource.com/18956 Reviewed-by: Rob Pike <r@golang.org> X-Blog-Commit: 257114af91a0defb1fc2c16c7f4ae2429b8a4e0f
Perhaps in effective go. Also worth mention in go1.5.html?
see https://groups.google.com/forum/#!topic/golang-dev/ya5vE0G62Z4.
The text was updated successfully, but these errors were encountered: