package gentools func CopyMap[K comparable, V any](m map[K]V) map[K]V { m2 := make(map[K]V, len(m)+1) for k, v := range m { m2[k] = v } return m2 } func OneItemMap[K comparable, V any](key K, value V) map[K]V { m := make(map[K]V, 1) m[key] = value return m } func MapKeys[K comparable, V any](m map[K]V) []K { keys := make([]K, 0, len(m)) for key := range m { keys = append(keys, key) } return keys }