Skip to content
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

cmd/doc: why not show doc for individual struct fields? #19169

Closed
willfaught opened this issue Feb 18, 2017 · 4 comments
Closed

cmd/doc: why not show doc for individual struct fields? #19169

willfaught opened this issue Feb 18, 2017 · 4 comments

Comments

@willfaught
Copy link
Contributor

Go v1.8 enabled go doc to show the doc for an individual interface method, so why not do the same for struct fields? Like:

$ go doc net/http RoundTripper.RoundTrip
// RoundTrip executes a single HTTP transaction, returning
// a Response for the provided Request.
//
// RoundTrip should not attempt to interpret the response. In
// particular, RoundTrip must return err == nil if it obtained
// a response, regardless of the response's HTTP status code.
// A non-nil err should be reserved for failure to obtain a
// response. Similarly, RoundTrip should not attempt to
// handle higher-level protocol details such as redirects,
// authentication, or cookies.
//
// RoundTrip should not modify the request, except for
// consuming and closing the Request's Body.
//
// RoundTrip must always close the body, including on errors,
// but depending on the implementation may do so in a separate
// goroutine even after RoundTrip returns. This means that
// callers wanting to reuse the body for subsequent requests
// must arrange to wait for the Close call before doing so.
//
// The Request's URL and Header fields must be initialized.
func RoundTrip(*Request) (*Response, error)

$ go doc net/http Response.Header
// Header maps header keys to values. If the response had multiple
// headers with the same key, they may be concatenated, with comma
// delimiters.  (Section 4.2 of RFC 2616 requires that multiple headers
// be semantically equivalent to a comma-delimited sequence.) Values
// duplicated by other fields in this struct (e.g., ContentLength) are
// omitted from Header.
//
// Keys in the map are canonicalized (see CanonicalHeaderKey).
var Header Header
@luigi-riefolo
Copy link
Contributor

I'd be happy to work on this if the enhancement gets approved.

@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 21, 2017
@bradfitz
Copy link
Contributor

To @robpike for decision.

@bradfitz bradfitz added this to the Go1.9Maybe milestone Mar 21, 2017
@robpike
Copy link
Contributor

robpike commented Mar 21, 2017

Makes sense, shouldn't be too hard.

@robpike robpike removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 21, 2017
@gopherbot
Copy link

CL https://golang.org/cl/38438 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 22, 2018
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants