Arrays, Slices, Maps, Strings, Runes, and Core Data Structures
Work with the Go data structures that appear constantly in backend services, tools, and real applications.
Inside this chapter
- Arrays vs Slices
- Maps
- Strings and Runes
- Why Slices Matter So Much
- Business Example
Series navigation
Study the chapters in order for the clearest path from Golang basics to advanced concurrency, service design, and production engineering. Use the navigation at the bottom to move smoothly through the full tutorial series.
Arrays vs Slices
Arrays have a fixed size, while slices are more flexible views over arrays and are used much more often in day-to-day Go development.
numbers := []int{1, 2, 3}
numbers = append(numbers, 4) Maps
userRoles := map[string]string{
"asha": "admin",
"ravi": "editor",
}
Maps store key-value relationships and are central to configuration, indexing, counts, lookups, caches, and decoded JSON structures.
Strings and Runes
Strings in Go are immutable byte sequences. When dealing with Unicode characters, runes become important. This distinction matters when counting or slicing user-facing text.
Why Slices Matter So Much
Many database results, API responses, file lines, work queues, and transformed collections are naturally represented as slices. Understanding length, capacity, append behavior, and shared backing arrays is an important intermediate Go skill.
Business Example
An order service may fetch a slice of orders, use a map to group them by status, and process string fields for customer notifications. These core data structures power most backend workflows.