Documentation

Overview

    Doc is an old program that was used to design a nice command-level API for presenting Go documentation. It is deprecated; use the new go doc in 1.5 instead.

    Doc is a simple document printer that produces the doc comments for its argument symbols, plus a link to the full documentation and a pointer to the source. It has a more Go-like UI than godoc. It can also search for symbols by looking in all packages, and case is ignored. For instance:

    doc isupper
    

    will find unicode.IsUpper.

    The -pkg flag retrieves package-level doc comments only.

    Usage:

    doc pkg.name   # "doc io.Writer"
    doc pkg name   # "doc fmt Printf"
    doc name       # "doc isupper" (finds unicode.IsUpper)
    doc -pkg pkg   # "doc fmt"
    

    The pkg is the last element of the package path; no slashes (ast.Node not go/ast.Node).

    The name may also be a regular expression to select which names to match. In regular expression searches, case is ignored and the pattern must match the entire name, so ".?print" will match Print, Fprint and Sprint but not Fprintf.

    Flags

    -c(onst) -f(unc) -i(nterface) -m(ethod) -s(truct) -t(ype) -v(ar)
    

    restrict hits to declarations of the corresponding kind. Flags

    -doc -src -url
    

    restrict printing to the documentation, source path, or godoc URL. Flags

    -doc -src -url
    

    restrict printing to the documentation, source path, or godoc URL. Flag

    -r
    

    takes a single argument (no package), a name or regular expression to search for in all packages.

    Source Files