Skip to content

reflect: NumMethod doesn't return not exported members of method sets #17686

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

Closed
mlowicki opened this issue Oct 31, 2016 · 4 comments
Closed

reflect: NumMethod doesn't return not exported members of method sets #17686

mlowicki opened this issue Oct 31, 2016 · 4 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge

Comments

@mlowicki
Copy link
Contributor

What version of Go are you using (go version)?

go version go1.7.1 darwin/amd64

What operating system and processor architecture are you using (go env)?

> go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mlowicki/projects/golang/spec"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

Repro

https://play.golang.org/p/eXoyuqajG6

Expected result

I expect to see method n also printed out and language spec doesn't enforce that method set contains only exported identifiers.

Currently it displays only info about M:

Number of methods: 1
Method {M  func(main.T) <func(main.T) Value> %!s(int=0)}
	Name: M
	PkgPath: 
@wendigo
Copy link

wendigo commented Oct 31, 2016

@robpike robpike added the Documentation Issues describing a change to documentation. label Oct 31, 2016
@robpike
Copy link
Contributor

robpike commented Oct 31, 2016

It's a documentation issue. The word 'exported' should appear in the explanation.

@rakyll rakyll changed the title NumMethod from reflect package doesn't return not exported members of method sets reflect: NumMethod doesn't return not exported members of method sets Oct 31, 2016
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/32420 mentions this issue.

gopherbot pushed a commit that referenced this issue Jun 29, 2017
Updates #17686
Fixes #20848

Change-Id: I35d58c7d1aa74d3e7867124070e27c787d444b04
Reviewed-on: https://go-review.googlesource.com/47210
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/47210 mentions this issue: reflect: document that value.NumMethod counts exported methods

@golang golang locked and limited conversation to collaborators Jul 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants