You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The godoc tool groups constructors with the types they construct in the package index. This is incredibly useful for organizing documentation and quickly understanding the relationships between package symbols.
In contrast, while the go doc tool does this grouping when you ask for a particular type's documentation, for package documentation it prints all functions before it prints types. It would be nice if the package documentation was grouped similarly to what godoc does.
For example, the current go doc output for "go doc reflect" looks like:
$ go doc reflect
...
func Copy(dst, src Value) int
func DeepEqual(x, y interface{}) bool
func Select(cases []SelectCase) (chosen int, recv Value, recvOK bool)
func ArrayOf(count int, elem Type) Type
func ChanOf(dir ChanDir, t Type) Type
func FuncOf(in, out []Type, variadic bool) Type
func MapOf(key, elem Type) Type
func PtrTo(t Type) Type
func SliceOf(t Type) Type
func TypeOf(i interface{}) Type
func Append(s Value, x ...Value) Value
func AppendSlice(s, t Value) Value
func Indirect(v Value) Value
func MakeChan(typ Type, buffer int) Value
func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value
func MakeMap(typ Type) Value
func MakeSlice(typ Type, len, cap int) Value
func New(typ Type) Value
func NewAt(typ Type, p unsafe.Pointer) Value
func ValueOf(i interface{}) Value
func Zero(typ Type) Value
type ChanDir int
type Kind uint
type Method struct { ... }
type SelectCase struct { ... }
type SelectDir int
type SliceHeader struct { ... }
type StringHeader struct { ... }
type StructField struct { ... }
type StructTag string
type Type interface { ... }
type Value struct { ... }
type ValueError struct { ... }
...
Something is clearly putting constructor functions together, but they're printed separately from the type they construct. This would be much clearer if it were something like the following:
$ go doc reflect
...
func Copy(dst, src Value) int
func DeepEqual(x, y interface{}) bool
func Select(cases []SelectCase) (chosen int, recv Value, recvOK bool)
type ChanDir int
type Kind uint
type Method struct { ... }
type SelectCase struct { ... }
type SelectDir int
type SliceHeader struct { ... }
type StringHeader struct { ... }
type StructField struct { ... }
type StructTag string
type Type interface { ... }
func ArrayOf(count int, elem Type) Type
func ChanOf(dir ChanDir, t Type) Type
func FuncOf(in, out []Type, variadic bool) Type
func MapOf(key, elem Type) Type
func PtrTo(t Type) Type
func SliceOf(t Type) Type
func TypeOf(i interface{}) Type
type Value struct { ... }
func Append(s Value, x ...Value) Value
func AppendSlice(s, t Value) Value
func Indirect(v Value) Value
func MakeChan(typ Type, buffer int) Value
func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value
func MakeMap(typ Type) Value
func MakeSlice(typ Type, len, cap int) Value
func New(typ Type) Value
func NewAt(typ Type, p unsafe.Pointer) Value
func ValueOf(i interface{}) Value
func Zero(typ Type) Value
type ValueError struct { ... }
...
The godoc tool groups constructors with the types they construct in the package index. This is incredibly useful for organizing documentation and quickly understanding the relationships between package symbols.
In contrast, while the go doc tool does this grouping when you ask for a particular type's documentation, for package documentation it prints all functions before it prints types. It would be nice if the package documentation was grouped similarly to what godoc does.
For example, the current go doc output for "go doc reflect" looks like:
Something is clearly putting constructor functions together, but they're printed separately from the type they construct. This would be much clearer if it were something like the following:
/cc @robpike @griesemer
The text was updated successfully, but these errors were encountered: