Skip to content

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

@mlowicki

Description

@mlowicki

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: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions