1
0
mirror of https://github.com/golang/go synced 2024-11-12 05:50:21 -07:00
go/lib/godoc
Andrew Gerrand af1ae438b9 go/doc, godoc, gotest: support for reading example documentation
This CL introduces the go.Example type and go.Examples functions that
are used to represent and extract code samples from Go source.

They should be of the form:

// Output of this function.
func ExampleFoo() {
        fmt.Println("Output of this function.")
}

It also modifies godoc to read example code from _test.go files,
and include them in the HTML output with JavaScript-driven toggles.

It also implements testing of example functions with gotest.
The stdout/stderr is compared against the output comment on the
function.

This CL includes examples for the sort.Ints function and the
sort.SortInts type. After patching this CL in and re-building go/doc
and godoc, try
        godoc -http=localhost:6060
and visit http://localhost:6060/pkg/sort/

R=gri, r, rsc
CC=golang-dev
https://golang.org/cl/5137041
2011-10-06 11:56:17 -07:00
..
codewalk.html exp/template: rename filter: url -> urlquery. 2011-08-13 14:00:16 +10:00
codewalkdir.html godoc: template cleanup 2011-08-17 16:38:58 -07:00
dirlist.html godoc: template cleanup 2011-08-17 16:38:58 -07:00
error.html godoc: first round of template cleanups 2011-08-12 10:06:32 -07:00
example.html go/doc, godoc, gotest: support for reading example documentation 2011-10-06 11:56:17 -07:00
godoc.html godoc: fix godoc.html template bug: correctly display package roots 2011-08-14 08:56:47 +10:00
package.html go/doc, godoc, gotest: support for reading example documentation 2011-10-06 11:56:17 -07:00
package.txt godoc: fix lib/godoc/package.txt template 2011-08-15 15:42:27 -07:00
search.html godoc: show packages matching a query at the top 2011-09-08 15:35:56 -07:00
search.txt godoc: fine tuning of template file 2011-09-08 18:27:26 -07:00