Skip to content

reflect: StructOf returns types with unpopulated StructField.PkgPath #36191

@dsnet

Description

@dsnet

At tip, the following:

t := reflect.StructOf([]reflect.StructField{{
	Name:    "height",
	PkgPath: "path/to/pkg",
	Type:    reflect.TypeOf(float64(0)),
}})
fmt.Println(t.Field(0).PkgPath)

This currently prints nothing. I expect it to print path/to/pkg otherwise logic to detect unexported fields doesn't work properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions