import "github.com/coreos/go-etcd/etcd" etcdClient := etcd.NewClient([]string{"http://localhost:4001"}) response, err := etcdClient.Get("mykey", false, false) if err != nil { fmt.Println(err) return } fmt.Println(response.Node.Value)
import "github.com/coreos/go-etcd/etcd" etcdClient := etcd.NewClient([]string{"http://localhost:4001"}) response, err := etcdClient.Get("mykey", true, false) if err != nil { fmt.Println(err) return } for _, node := range response.Node.Nodes { fmt.Println(node.Key, node.Value) }In this example, the same client is created and the Get function is called with the recursive flag set to true. This means that all values associated with the given key will be retrieved. The response is then looped over and each node's key and value are printed to the console. Package Library: github.com/coreos/go-etcd/etcd