Structs (Custom Data Types & Nested Structs) - Go Tutorial for Beginners #15

5views
00
11:00
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
Master structs in Go - create your own custom data types! In this lesson, you will learn: ✓ Defining struct types ✓ Creating struct instances ✓ Named fields vs positional initialization ✓ Accessing and modifying fields ✓ Struct copying (by value) ✓ Struct comparison ✓ Nested structs ✓ Anonymous structs for one-time use ⏱️ Timestamps: 0:00 - Introduction 0:27 - Struct Basics 2:45 - Modifying Struct Fields 4:58 - Nested Structs 7:19 - Anonymous Structs 9:34 - Recap 10:04 - End 💻 Source Code: https://github.com/GoCelesteAI/go_structs 📝 Code Highlights: // Define a struct type Person struct { Name string Age int City string } // Create with named fields (preferred) p := Person{Name: "Alice", Age: 25, City: "NYC"} // Access fields with dot notation fmt.Println(p.Name) // Alice p.Age = 26 // Modify field // Nested structs type Employee struct { Name string Address Address // Nested struct } fmt.Println(emp.Address.City) // Access nested field // Anonymous struct (one-time use) config := struct { Host string Port int }{ Host: "localhost", Port: 8080, } // Structs are copied by value copy := original // Independent copy 📺 Full Playlist: Go Tutorial for Beginners 📺 Previous: Lesson 14 - Pointers 📺 Next: Lesson 16 - Struct Methods 👍 Like and Subscribe for more Go tutorials! #Go #Golang #Programming #Tutorial #Structs #DataTypes #OOP #LearnToCode

Tags

GoGolangGo tutorialGo for beginnerslearn GoGo programmingstructsdata typesnested structsanonymous structscustom typesprogramming tutorialCelesteAI
Back to tutorials

Duration

11:00

Published

February 1, 2026

Added to Codegiz

March 15, 2026

Open in YouTube