func (y *Yaml) SetPath(branch []string, val interface{}) {
	if len(branch) == 0 {
		y.data = val
		return
	}

	// in order to insert our branch, we need map[interface{}]interface{}
	if _, ok := (y.data).(map[interface{}]interface{}); !ok {
		// have to replace with something suitable
		y.data = make(map[interface{}]interface{})
	}
	curr := y.data.(map[interface{}]interface{})

	for i := 0; i < len(branch)-1; i++ {
		b := branch[i]
		// key exists?
		if _, ok := curr[b]; !ok {
			n := make(map[interface{}]interface{})
			curr[b] = n
			curr = n
			continue
		}

		// make sure the value is the right sort of thing
		if _, ok := curr[b].(map[interface{}]interface{}); !ok {
			// have to replace with something suitable
			n := make(map[interface{}]interface{})
			curr[b] = n
		}

		curr = curr[b].(map[interface{}]interface{})
	}

	// add remaining k/v
	curr[branch[len(branch)-1]] = val
}
// SetPath modifies `Yaml`, recursively checking/creating map keys for the supplied path,
// and then finally writing in the value
SetPath modifies `Yaml`, recursively checking/creating map keys for the supplied path,
and then finally writing in the value
// SetPath modifies ` Yaml ` recursively checking / creating map keys for the supplied path // and then finally writing in the value
func (y *Yaml) SetPath(branch []string, val interface{}) {
	if len(branch) == 0 {
		y.data = val
		return
	}
	if _, ok := (y.data).(map[interface{}]interface{}); !ok {
		y.data = make(map[interface{}]interface{})
	}
	curr := y.data.(map[interface{}]interface{})
	for i := 0; i < len(branch)-1; i++ {
		b := branch[i]
		if _, ok := curr[b]; !ok {
			n := make(map[interface{}]interface{})
			curr[b] = n
			curr = n
			continue
		}
		if _, ok := curr[b].(map[interface{}]interface{}); !ok {
			n := make(map[interface{}]interface{})
			curr[b] = n
		}
		curr = curr[b].(map[interface{}]interface{})
	}
	curr[branch[len(branch)-1]] = val
}
func ( y * Yaml ) SetPath ( branch [ ] string , val interface { } ) { if len ( branch ) == 0 { y . data = val return } if _ , ok := ( y . data ) . ( map [ interface { } ] interface { } ) ; ! ok { y . data = make ( map [ interface { } ] interface { } ) } curr := y . data . ( map [ interface { } ] interface { } ) for i := 0 ; i < len ( branch ) - 1 ; i ++ { b := branch [ i ] if _ , ok := curr [ b ] ; ! ok { n := make ( map [ interface { } ] interface { } ) curr [ b ] = n curr = n continue } if _ , ok := curr [ b ] . ( map [ interface { } ] interface { } ) ; ! ok { n := make ( map [ interface { } ] interface { } ) curr [ b ] = n } curr = curr [ b ] . ( map [ interface { } ] interface { } ) } curr [ branch [ len ( branch ) - 1 ] ] = val }
SetPath modifies `Yaml`, recursively checking/creating map keys for the supplied path,
and then finally writing in the value
SetPath modifies ` Yaml ` recursively checking / creating map keys for the supplied path and then finally writing in the value
// in order to insert our branch, we need map[interface{}]interface{} // have to replace with something suitable // key exists? // make sure the value is the right sort of thing // have to replace with something suitable // add remaining k/v