Back to course

Maps: Fast Key-Value Storage

Go (Golang) for Cloud-Native Microservices

Go Maps

Maps are hash tables. They are ultra-fast for looking up data by a key.

go users := make(map[string]int) users["alice"] = 30

// Checking existence age, exists := users["bob"] if !exists { fmt.Println("User not found") }

Warning: Maps are NOT thread-safe. We will learn how to handle this with Mutexes later.