template/funcs.go
func explodeHelper(m map[string]interface{}, k, v, p string) error {
	if strings.Contains(k, "/") {
		parts := strings.Split(k, "/")
		top := parts[0]
		key := strings.Join(parts[1:], "/")

		if _, ok := m[top]; !ok {
			m[top] = make(map[string]interface{})
		}
		nest, ok := m[top].(map[string]interface{})
		if !ok {
			return fmt.Errorf("not a map: %q: %q already has value %q", p, top, m[top])
		}
		return explodeHelper(nest, key, v, k)
	}

	if k != "" {
		m[k] = v
	}

	return nil
}
func explodeHelper(m map[string]interface{}, k, v, p string) error {
	if strings.Contains(k, "/") {
		parts := strings.Split(k, "/")
		top := parts[0]
		key := strings.Join(parts[1:], "/")

		if _, ok := m[top]; !ok {
			m[top] = make(map[string]interface{})
		}
		nest, ok := m[top].(map[string]interface{})
		if !ok {
			return fmt.Errorf("not a map: %q: %q already has value %q", p, top, m[top])
		}
		return explodeHelper(nest, key, v, k)
	}

	if k != "" {
		m[k] = v
	}

	return nil
}
func explodeHelper ( m map [ string ] interface { } , k , v , p string ) error { if strings . Contains ( k , " " ) { parts := strings . Split ( k , " " ) top := parts [ 0 ] key := strings . Join ( parts [ 1 : ] , " " ) if _ , ok := m [ top ] ; ! ok { m [ top ] = make ( map [ string ] interface { } ) } nest , ok := m [ top ] . ( map [ string ] interface { } ) if ! ok { return fmt . Errorf ( " " , p , top , m [ top ] ) } return explodeHelper ( nest , key , v , k ) } if k != " " { m [ k ] = v } return nil }
// explodeHelper is a recursive helper for explode.
explodeHelper is a recursive helper for explode .