• Volker Dobler's avatar
    cmd/godoc: show examples in text mode · d97b975d
    Volker Dobler authored
    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
    d97b975d
Name
Last commit
Last update
..
5a Loading commit data...
5c Loading commit data...
5g Loading commit data...
5l Loading commit data...
6a Loading commit data...
6c Loading commit data...
6g Loading commit data...
6l Loading commit data...
8a Loading commit data...
8c Loading commit data...
8g Loading commit data...
8l Loading commit data...
addr2line Loading commit data...
api Loading commit data...
cc Loading commit data...
cgo Loading commit data...
cov Loading commit data...
dist Loading commit data...
fix Loading commit data...
gc Loading commit data...
go Loading commit data...
godoc Loading commit data...
gofmt Loading commit data...
ld Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
prof Loading commit data...
vet Loading commit data...
yacc Loading commit data...