Use len() to get the number of key-value pairs:
ages := map[string]int{"Alice": 30, "Bob": 25}
fmt.Println(len(ages)) // 2
delete(ages, "Alice")
fmt.Println(len(ages)) // 1
The length decreases when you delete entries and increases when you add them. Unlike slices, maps don't have a separate capacity.