Reputation: 162
I'm still struggling to word the question in a way that is quick to understand, so I'll instead document the steps I followed to encounter the issue I am facing.
godoc net/http Request
*url.URL
whose documentation I'd like to lookup.What steps do I follow to get to the specific url
package being referenced in the above piece of documentation ?
Upvotes: 0
Views: 605
Reputation: 7888
In Go 1.5 you can use the new go doc
sub-command:
Show documentation for package or symbol
Usage:
go doc [-u] [-c] [package|[package.]symbol[.method]]
Doc prints the documentation comments associated with the item identified by its arguments (a package, const, func, type, var, or method) followed by a one-line summary of each of the first-level items "under" that item (package-level declarations for a package, methods for a type, etc.).
[…]
When run with one argument, the argument is treated as a Go-syntax-like representation of the item to be documented. What the argument selects depends on what is installed in GOROOT and GOPATH, as well as the form of the argument, which is schematically one of these:
go doc <pkg> go doc <sym>[.<method>] go doc [<pkg>].<sym>[.<method>]
The first item in this list matched by the argument is the one whose documentation is printed. (See the examples below.) For packages, the order of scanning is determined lexically, but the GOROOT tree is always scanned before GOPATH.
So for your example just go doc url.URL
without you needing to know that the url
package is imported as net/url
.
Until Go 1.5 is released there is a very simalar command that you can install with:
go install robpike.io/cmd/doc
Once installed you'd do doc url.URL
.
Upvotes: 2
Reputation: 13542
You can run queries with godoc
:
$ godoc -q URL | less
QUERY
URL
DID YOU MEAN
url
Types
net/url.URL
html/template.URL
...
...
...
The net/url in Types is a good candidate to look at.
$ godoc net/url | less
PACKAGE DOCUMENTATION
package url
import "net/url"
Package url parses URLs and implements query escaping. See RFC 3986.
FUNCTIONS
...
...
...
Upvotes: 1