Skip to content

cmd/doc: not printing package name in type query #31457

Closed
@rsc

Description

@rsc

go doc big.NewInt tells me what package it is talking about:

$ go doc big.NewInt
package big // import "math/big"

func NewInt(x int64) *Int
    NewInt allocates and returns a new Int set to x.

$ 

but go doc big.Int does not:

$ go doc big.Int
type Int struct {
	// Has unexported fields.
}
    An Int represents a signed multi-precision integer. The zero value for an
    Int represents the value 0.

    Operations always take pointer arguments (*Int) rather than Int values, and
    each unique Int value requires its own unique *Int pointer. To "copy" an Int
    value, an existing (or newly allocated) Int must be set to a new value using
    the Int.Set method; shallow copies of Ints are not supported and may lead to
    errors.

func NewInt(x int64) *Int
func (z *Int) Abs(x *Int) *Int
func (z *Int) Add(x, y *Int) *Int
...

It seems like the package line should be printed always, and there is just a bug in this code path.

/cc @robpike

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions