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

cmd/doc: not listing all constants #16549

Closed
reusee opened this issue Jul 30, 2016 · 2 comments
Closed

cmd/doc: not listing all constants #16549

reusee opened this issue Jul 30, 2016 · 2 comments

Comments

@reusee
Copy link

reusee commented Jul 30, 2016

  1. What version of Go are you using (go version)?
    go version devel +111d590 Fri Jul 29 01:09:55 2016 +0000 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/reus"
    GORACE=""
    GOROOT="/home/reus/go"
    GOTOOLDIR="/home/reus/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build397350464=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"
  3. What did you do?
    go doc reflect.Kind
  4. What did you expect to see?
    All Kind constants
  5. What did you see instead?
    const Invalid Kind = iota ...

It would be more helpful if all constants are listed, like on godoc.org https://godoc.org/reflect#Kind

@dsnet
Copy link
Member

dsnet commented Jul 30, 2016

I believe this is working as intended. The documentation says:

Doc prints the documentation comments associated with the item identified by its
arguments (a package, const, func, type, var, or method) followed by a one-line
summary
of each of the first-level items "under" that item (package-level
declarations for a package, methods for a type, etc.).

Once, you see that there is a list of constants under Kind, you can list them by then calling go doc reflect.Invalid to see the full list of constants:

$ go doc reflect.Invalid
const (
    Invalid Kind = iota
    Bool
    Int
    Int8
    Int16
    Int32
    Int64
    Uint
    Uint8
    Uint16
    Uint32
    Uint64
    Uintptr
    Float32
    Float64
    Complex64
    Complex128
    Array
    Chan
    Func
    Interface
    Map
    Ptr
    Slice
    String
    Struct
    UnsafePointer
)

@robpike
Copy link
Contributor

robpike commented Jul 30, 2016

Yes, working as intended, although perhaps the behavior isn't ideal in some circumstances. The intent is to keep the output manageable at each step. The output from
godoc reflect Kind
is in fact a good example why: It's far too much.

@robpike robpike closed this as completed Jul 30, 2016
@golang golang locked and limited conversation to collaborators Jul 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants