1
0
mirror of https://github.com/golang/go synced 2024-10-04 06:21:23 -06:00
Commit Graph

3 Commits

Author SHA1 Message Date
Olivier Duperray
e97a55810f godoc: <pre> must not occur inside <p>
Fixes #2532

R=golang-dev, dr.volker.dobler, rsc
CC=golang-dev
https://golang.org/cl/5450115
2011-12-07 15:00:38 -05:00
Volker Dobler
1e5aecf6ce godoc: improved output of examples in html.
Fixes #2467.
Fixes #2464.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5447051
2011-12-02 09:52:31 +11:00
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