func nodeToMap(node *etcd.Node, out map[string]string) bool {
	key := strings.TrimPrefix(node.Key, "/")
	if !node.Dir {
		if node.Value == "" {
			if _, ok := out[key]; ok {
				delete(out, key)
				return true
			}
			return false
		}
		if value, ok := out[key]; !ok || value != node.Value {
			out[key] = node.Value
			return true
		}
		return false
	}
	changed := false
	for _, node := range node.Nodes {
		changed = nodeToMap(node, out) || changed
	}
	return changed
}
func nodeToMap(node *etcd.Node, out map[string]string) bool {
	key := strings.TrimPrefix(node.Key, "/")
	if !node.Dir {
		if node.Value == "" {
			if _, ok := out[key]; ok {
				delete(out, key)
				return true
			}
			return false
		}
		if value, ok := out[key]; !ok || value != node.Value {
			out[key] = node.Value
			return true
		}
		return false
	}
	changed := false
	for _, node := range node.Nodes {
		changed = nodeToMap(node, out) || changed
	}
	return changed
}
func nodeToMap ( node * etcd . Node , out map [ string ] string ) bool { key := strings . TrimPrefix ( node . Key , " " ) if ! node . Dir { if node . Value == " " { if _ , ok := out [ key ] ; ok { delete ( out , key ) return true } return false } if value , ok := out [ key ] ; ! ok || value != node . Value { out [ key ] = node . Value return true } return false } changed := false for _ , node := range node . Nodes { changed = nodeToMap ( node , out ) || changed } return changed }
// nodeToMap translates the contents of a node into a map
// nodeToMap can be called on the same map with successive results from watch
// to accumulate a value
// nodeToMap returns true if out was modified
nodeToMap translates the contents of a node into a map nodeToMap can be called on the same map with successive results from watch to accumulate a value nodeToMap returns true if out was modified