func KeysToStringSlice()

in pkg/util/maps/map.go [30:59]


func KeysToStringSlice(m interface{}) ([]string, error) {
	switch m := m.(type) {
	case map[string]string:
		keys := make([]string, 0, len(m))
		for key := range m {
			keys = append(keys, key)
		}
		return keys, nil
	case map[string]int:
		keys := make([]string, 0, len(m))
		for key := range m {
			keys = append(keys, key)
		}
		return keys, nil
	case map[string]bool:
		keys := make([]string, 0, len(m))
		for key := range m {
			keys = append(keys, key)
		}
		return keys, nil
	case map[string]interface{}:
		keys := make([]string, 0, len(m))
		for key := range m {
			keys = append(keys, key)
		}
		return keys, nil
	default:
		return nil, fmt.Errorf("unexpected key type %T", m)
	}
}