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/link, reflect: difference in output depending what is linked in #15824

Closed
dsnet opened this issue May 24, 2016 · 1 comment
Closed

cmd/link, reflect: difference in output depending what is linked in #15824

dsnet opened this issue May 24, 2016 · 1 comment

Comments

@dsnet
Copy link
Member

dsnet commented May 24, 2016

Using 7b9d3ff

Consider the following program:

type Iface interface{}

type Foo struct{}

func (f *Foo) Foo() Iface { return nil }

type Bar struct{}

func (f *Bar) bar() Iface { return nil }

func main() {
    _ = reflect.ValueOf(&Foo{}).Type() // THIS

    t := reflect.ValueOf(&Bar{}).Type()
    for i := 0; i < t.NumMethod(); i++ {
        fmt.Println(t.Method(i))
    }
}

With the line labelled THIS present, the program properly outputs:
{bar main func(*main.Bar) main.Iface <func(*main.Bar) main.Iface Value> 0}

However, with the THIS line commented out, the program fails to output anything at all. The difference in output indicates that something is off since the line in question only pertains to the Foo type, while the subsequent lines only pertain to the Bar type.

This may be related to the comment by @reusee in #15673

/cc @crawshaw, @reusee, @rsc

@dsnet
Copy link
Member Author

dsnet commented May 24, 2016

Closing this, and re-opening #15673.

@dsnet dsnet closed this as completed May 24, 2016
@golang golang locked and limited conversation to collaborators May 24, 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

2 participants