Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/godoc: There should be a blank line between a code example and function definition #13053

0xmohit opened this issue Oct 26, 2015 · 1 comment


None yet
2 participants
Copy link

commented Oct 26, 2015

When viewing examples in command line mode, those should be followed by a newline.

For example, below is a snippet of output from godoc -ex strings:

func Contains(s, substr string) bool
    Contains reports whether substr is within s.

        fmt.Println(strings.Contains("seafood", "foo"))
        fmt.Println(strings.Contains("seafood", "bar"))
        fmt.Println(strings.Contains("seafood", ""))
        fmt.Println(strings.Contains("", ""))
        // Output:
        // true
        // false
        // true
        // true
func ContainsAny(s, chars string) bool
    ContainsAny reports whether any Unicode code points in chars are within

        fmt.Println(strings.ContainsAny("team", "i"))
        fmt.Println(strings.ContainsAny("failure", "u & i"))
        fmt.Println(strings.ContainsAny("foo", ""))
        fmt.Println(strings.ContainsAny("", ""))
        // Output:
        // false
        // true
        // false
        // false
func ContainsRune(s string, r rune) bool
    ContainsRune reports whether the Unicode code point r is within s.

func Count(s, sep string) int
    Count counts the number of non-overlapping instances of sep in s. If sep
    is an empty string, Count returns 1 + the number of Unicode code points
    in s.

        fmt.Println(strings.Count("cheese", "e"))
        fmt.Println(strings.Count("five", "")) // before & after each rune
        // Output:
        // 3
        // 5
func EqualFold(s, t string) bool
    EqualFold reports whether s and t, interpreted as UTF-8 strings, are
    equal under Unicode case-folding.

        fmt.Println(strings.EqualFold("Go", "go"))
        // Output: true

@0xmohit 0xmohit changed the title x/tools/cmd/godoc: No blank line preceding a function when viewing examples x/tools/cmd/godoc: There should be a blank line between a code example and function definition Oct 26, 2015


This comment has been minimized.

Copy link

commented Oct 26, 2015

CL mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 4, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.