Skip to content

text/template: inconsistency when accessing a field of an interface field #12924

@nodirt

Description

@nodirt

In a pipeline {{.Foo.Bar}} where Foo field is declared as of type interface I and points to a struct S that implements I and has Bar field:

  • Bar can be resolved if I is interface{}
  • Bar cannot be resolved if I is a non-empty interface

http://play.golang.org/p/Knps5C6aaL

I think this is inconsistent, Bar should be resolvable with non-empty I.
This wasn't catched by tests because there is a test for interface{}, but not for a non-empty interface.

I'd like to work on this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions