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

cmd/doc: default view does not show methods #28906

Open
rogpeppe opened this Issue Nov 21, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@rogpeppe
Contributor

rogpeppe commented Nov 21, 2018

$ go version
go version devel +14608976db Thu Nov 15 23:37:20 2018 +0000 linux/amd64

If I run go doc strings, it shows exported functions but not methods:

go doc strings Output
% go doc strings
package strings // import "strings"

Package strings implements simple functions to manipulate UTF-8 encoded
strings.

For information about UTF-8 strings in Go, see
https://blog.golang.org/strings.

func Compare(a, b string) int
func Contains(s, substr string) bool
func ContainsAny(s, chars string) bool
func ContainsRune(s string, r rune) bool
func Count(s, substr string) int
func EqualFold(s, t string) bool
func Fields(s string) []string
func FieldsFunc(s string, f func(rune) bool) []string
func HasPrefix(s, prefix string) bool
func HasSuffix(s, suffix string) bool
func Index(s, substr string) int
func IndexAny(s, chars string) int
func IndexByte(s string, c byte) int
func IndexFunc(s string, f func(rune) bool) int
func IndexRune(s string, r rune) int
func Join(a []string, sep string) string
func LastIndex(s, substr string) int
func LastIndexAny(s, chars string) int
func LastIndexByte(s string, c byte) int
func LastIndexFunc(s string, f func(rune) bool) int
func Map(mapping func(rune) rune, s string) string
func Repeat(s string, count int) string
func Replace(s, old, new string, n int) string
func ReplaceAll(s, old, new string) string
func Split(s, sep string) []string
func SplitAfter(s, sep string) []string
func SplitAfterN(s, sep string, n int) []string
func SplitN(s, sep string, n int) []string
func Title(s string) string
func ToLower(s string) string
func ToLowerSpecial(c unicode.SpecialCase, s string) string
func ToTitle(s string) string
func ToTitleSpecial(c unicode.SpecialCase, s string) string
func ToUpper(s string) string
func ToUpperSpecial(c unicode.SpecialCase, s string) string
func Trim(s string, cutset string) string
func TrimFunc(s string, f func(rune) bool) string
func TrimLeft(s string, cutset string) string
func TrimLeftFunc(s string, f func(rune) bool) string
func TrimPrefix(s, prefix string) string
func TrimRight(s string, cutset string) string
func TrimRightFunc(s string, f func(rune) bool) string
func TrimSpace(s string) string
func TrimSuffix(s, suffix string) string
type Builder struct{ ... }
type Reader struct{ ... }
func NewReader(s string) *Reader
type Replacer struct{ ... }
func NewReplacer(oldnew ...string) *Replacer

BUG: The rule Title uses for word boundaries does not handle Unicode punctuation properly.

There is no indication that (for example) Builder has a bunch of unexported methods.

In the package summaries on godoc.org and golang.org/pkg pages, exported methods are shown (but, like go doc, fields, constants and variables are omitted).

Perhaps go doc should use the same heuristics as godoc.org and include exported methods too.

@mvdan mvdan added the NeedsDecision label Nov 21, 2018

@mvdan

This comment has been minimized.

Member

mvdan commented Nov 21, 2018

/cc @robpike as per https://dev.golang.org/owners/.

There's go doc -all strings, which does print methods, but it also prints documentation so the output is too large for a quick summary.

It's also interesting that its help line is -all show all documentation for package. Reading that, it seems weird how it affects whether methods are shown as well. Edit: ignore this bit. I just noticed how it says "all the documentation", while I read it as "all the godoc comments".

@FiloSottile FiloSottile changed the title from cmd/go: doc does not show methods to cmd/doc: default view does not show methods Dec 12, 2018

@FiloSottile

This comment has been minimized.

Member

FiloSottile commented Dec 12, 2018

+1, I find the default go doc view extremely unhelpful on most packages, like crypto/tls, because most functionality is implemented in methods.

/cc @dmitshur

@FiloSottile FiloSottile added this to the Go1.12 milestone Dec 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment