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 Promoted Methods in Golang Structure 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 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 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 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 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 Like