- removed gratuitous empty lines that creeped into command line output
- changed comment color to a dark green so that links don't visually melt into them
- removed some TODOs
- updated doc.go
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8108044
- convert all formatters that require a *token.FileSet to
consistenly use a *PageInfo as first argument instead
- adjust templates correspondingly
- fix outstanding bug from previous CL 8005044
Going forward, with this change the affected functions have
access to the full page "context" (PageInfo), not just the
respective file set. This will permit better context-dependent
formatting in the future.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7860049
The changes are almost completely self-contained
in the new file linkify.go. The other changes are
minimal and should not disturb the currently
working godoc, in anticipation of Go 1.1.
To disable the feature in case of problems, set
-links=false.
Fixes#2063.
R=adg, r
CC=golang-dev
https://golang.org/cl/7883044
- A note doesn't have to be in the first
comment of a comment group anymore, and
several notes may appear in the same comment
group (e.g., it is fairly common to have a
TODO(uid) note immediately following another
comment).
- Define a doc.Note type which also contains
note uid and position info.
- Better formatting in godoc output. The position
information is not yet used, but could be used to
locate the note in the source text if desired.
Fixes#4843.
R=r, cnicolaou
CC=gobot, golang-dev
https://golang.org/cl/7496048
Fixes the App Engine version of godoc. The other fix is to duplicate
this code inside appinit.go. I think initHandlers is the right place
to put the strings.Split call, as the notesToShow var is used by
docServer, which is what initHandlers sets up.
R=dsymonds
CC=golang-dev
https://golang.org/cl/7434044
pkg/go/doc: move BUG notes from Package.Bugs to the general Package.Notes field.
Removing .Bugs would break existing code so it's left in for now.
R=gri, gri, gary.burd, dsymonds, rsc, kevlar
CC=golang-dev
https://golang.org/cl/7341053
Added the command line flag -ex to godoc to print examples in
text output.
Samples from the generated output:
$ godoc -ex strings Index
...
func Index(s, sep string) int
Index returns the index of the first instance of sep in s, or -1 if sep
is not present in s.
Example:
fmt.Println(strings.Index("chicken", "ken"))
fmt.Println(strings.Index("chicken", "dmr"))
// Output:
// 4
// -1
...
$ godoc -ex container/heap
...
package heap
import "container/heap"
Package heap provides heap operations for any type that implements
heap.Interface. A heap is a tree with the property that each node is the
minimum-valued node in its subtree.
Example:
// This example demonstrates an integer heap built using the heap interface.
package heap_test
import (
"container/heap"
"fmt"
...
Example:
// This example demonstrates a priority queue built using the heap interface.
package heap_test
import (
"container/heap"
"fmt"
)
...
Fixes#3587.
R=golang-dev, minux.ma, adg, rsc, gri
CC=golang-dev
https://golang.org/cl/7356043
Also:
- faster code for example extraction
- simplify handling of command documentation:
all "main" packages are treated as commands
- various minor cleanups along the way
For commands written in Go, any doc.go file containing
documentation must now be part of package main (rather
then package documentation), otherwise the documentation
won't show up in godoc (it will still build, though).
For commands written in C, documentation may still be
in doc.go files defining package documentation, but the
recommended way is to explicitly ignore those files with
a +build ignore constraint to define package main.
Fixes#4806.
R=adg, rsc, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7333046
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.
R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
`godoc net/http` used to complain "/target contains more than one package: http, main"
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6852100
Package format is a utility package that takes care of
parsing, sorting of imports, and formatting of .go source
using the canonical gofmt formatting parameters.
Use go/format in various clients instead of the lower-level components.
R=r, bradfitz, dave, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/6852075
Unlike when using -http, godoc -url didn't initialize the "filesystem"
and metadata that are used when generating responses. This CL adds this
initialization, so that -url provides the same results as an HTTP
request when using -http.
Fixes#4335.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/6817075
Updates setup-godoc-app.bash to produce a working godoc app
by substituting the go1.0.x go/... packages with those from tip.
R=gri
CC=golang-dev
https://golang.org/cl/6587080
FormatSelections tries to call a nil function value if lw is nil
and the final entry in the selections array is non-nil. Luckily,
this doesn't actually happen in practice since godoc doesn't use
this combination (no line numbers, but with selections).
R=gri
CC=gobot, golang-dev
https://golang.org/cl/6488106
This is a new, not yet committed API.
- Changed NewCommentMap to be independent of
*File nodes and more symmetric with the
Filter and Comments methods.
- Implemented Update method for use in
AST modifications.
- Implemented String method for debugging
R=rsc
CC=golang-dev
https://golang.org/cl/6303086
- interface methods appeared under VarDecl in search results
(long-standing TODO)
- don't walk parts of AST which contain no indexable material
(minor performance tuning)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6228047
In a browser with many open tabs, the tab titles become short
and uninformative because they all start with the same prefix
("Package ", "Directory ", etc.).
Permit use of shorter tab titles that start with the relevant
information first.
Fixes#3365.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5865056