Promoted Fields in Golang Structure Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In Go structure, promoted fields are just like anonymous fields, the type of the field is the name of the field. We use this concept in the nested structure where a structure is a field in another structure, simply by just adding the name of the structure into another structure and it behaves like the Anonymous Field to the nested structure. And the fields of that structure (other than nested structure) are the part of the nested structure, such type of fields are known as Promoted fields. If the anonymous structure or nested structure and parent structure contains a field that has the same name, then that field doesn't promote, only different name fields get promoted to the structure. Syntax: type x struct{ // Fields } type y struct{ // Fields of y structure x } Let us discuss this concept with the help of an example: Example: C // Go program to illustrate the // concept of the promoted fields package main import "fmt" // Structure type details struct { // Fields of the // details structure name string age int gender string } // Nested structure type student struct { branch string year int details } func main() { // Initializing the fields of // the student structure values := student{ branch: "CSE", year: 2010, details: details{ name: "Sumit", age: 28, gender: "Male", }, } // Promoted fields of the student structure fmt.Println("Name: ", values.name) fmt.Println("Age: ", values.age) fmt.Println("Gender: ", values.gender) // Normal fields of // the student structure fmt.Println("Year: ", values.year) fmt.Println("Branch : ", values.branch) } Output: Name: Sumit Age: 28 Gender: Male Year: 2010 Branch : CSE Explanation: In the above example, we have two structures named as details and student. Where details structure is the normal structure and student structure is the nested structure which contains the details structure as fields in it just like anonymous fields. Now, the fields of the details structure, i.e, name, age, and gender are promoted to the student structure and known as promoted fields. Now, you can directly access them with the help of the student structure like values.name, values.age, and values.gender. Comment More infoAdvertise with us Next Article Structure Equality in Golang A ankita_saini Follow Improve Article Tags : Go Language Golang Similar Reads Promoted Methods in Golang Structure In Go structure, the working of promoted methods is just like Promoted Fields. We use this concept in the nested structure where a structure is a field in another structure, simply by just adding the name of the structure into another structure and it behaves like the Anonymous Field to the nested s 3 min read Nested Structure in Golang A structure or struct in Golang is a user-defined type, which allows us to create a group of elements of different types into a single unit. Any real-world entity which has some set of properties or fields can be represented as a struct. Go language allows nested structure. A structure which is the 3 min read Structure Equality in Golang A structure or struct in Golang is a user-defined type, which allows us to create a group of elements of different types into a single unit. Any real-world entity which has some set of properties or fields can be represented as a struct. This concept is generally compared with the classes in object- 3 min read Structures in Golang A structure or struct in Golang is a user-defined type that allows to group/combine items of possibly different types into a single type. Any real-world entity which has some set of properties/fields can be represented as a struct. This concept is generally compared with the classes in object-orient 7 min read Embedded Structures in Golang In the Go programming language, Embedded Structures are a way to reuse a struct's fields without having to inherit from it. It allows you to include the fields and methods of an existing struct into a new struct. The new struct can add additional fields and methods to those it inherits. Syntax: type 2 min read Pointer to a Struct in Golang In Go, structs are used to create custom data types that group different fields together. When working with structs, using pointers can be especially beneficial for managing memory efficiently and for avoiding unnecessary copying of data. A pointer to a struct allows you to directly reference and mo 3 min read Like