// Merge merges two States.
Merge merges two States.
// Merge merges two States .
func (s State) Merge(a State) {
	for k, v := range a {
		if _, ok := s[k]; !ok {
			s[k] = v
			continue
		}
		dst := s[k]
		dstMap, dstOk := dst.(map[string]interface{})
		srcMap, srcOk := v.(map[string]interface{})
		if dstOk && srcOk {
			State(dstMap).Merge(srcMap)
			continue
		}
		s[k] = v
	}
}
func ( s State ) Merge ( a State ) { for k , v := range a { if _ , ok := s [ k ] ; ! ok { s [ k ] = v continue } dst := s [ k ] dstMap , dstOk := dst . ( map [ string ] interface { } ) srcMap , srcOk := v . ( map [ string ] interface { } ) if dstOk && srcOk { State ( dstMap ) . Merge ( srcMap ) continue } s [ k ] = v } }
Merge merges two States.
Merge merges two States .
// k isn't in the original map, set it. // Both original and incoming values are maps. // Otherwise, source overrides destination