Skip to content

proposal: reflect/v2: rename StructField.Anonymous to Embedded #18786

@sbinet

Description

@sbinet

in Go-1, we have:

$> go doc reflect StructField 
type StructField struct {
	// Name is the field name.
	Name string
	// PkgPath is the package path that qualifies a lower case (unexported)
	// field name. It is empty for upper case (exported) field names.
	// See https://golang.org/ref/spec#Uniqueness_of_identifiers
	PkgPath string

	Type      Type      // field type
	Tag       StructTag // field tag string
	Offset    uintptr   // offset within struct, in bytes
	Index     []int     // index sequence for Type.FieldByIndex
	Anonymous bool      // is an embedded field
}
    A StructField describes a single field in a struct.

The Anonymous field is a bit ambiguous or at least misleading.

For Go-2, rename it as Embedded.

(see: https://golang.org/cl/35732/ for context)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Proposalv2An incompatible library change

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions