import ( "github.com/coreos/etcd/client" "golang.org/x/net/context" "time" ) cfg := client.Config{ Endpoints: []string{"http://localhost:2379"}, Transport: client.DefaultTransport, HeaderTimeoutPerRequest: time.Second, } c, err := client.New(cfg) if err != nil { // handle error } defer c.Close() kapi := client.NewKeysAPI(c) value := "some-value" resp, err := kapi.Create(context.Background(), "/my-key", value) if err != nil { // handle error }
import ( "github.com/coreos/etcd/client" "golang.org/x/net/context" "time" ) cfg := client.Config{ Endpoints: []string{"http://localhost:2379"}, Transport: client.DefaultTransport, HeaderTimeoutPerRequest: time.Second, } c, err := client.New(cfg) if err != nil { // handle error } defer c.Close() kapi := client.NewKeysAPI(c) value := "new-value" resp, err := kapi.Update(context.Background(), "/my-key", value) if err != nil { // handle error }This example updates an existing key-value pair with the key "/my-key" and the new value "new-value". In conclusion, based on the import statement used in the code examples, the package library used is "github.com/coreos/etcd/client".