Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
clientv3
✓ go.etcd.io/etcd/client/v3
Connects to etcd and sets a key-value pair.
package main
import (
"context"
"fmt"
clientv3 "go.etcd.io/etcd/client/v3"
"time"
)
func main() {
cli, err := clientv3.New(clientv3.Config{
Endpoints: []string{"localhost:2379"},
DialTimeout: 5 * time.Second,
})
if err != nil {
panic(err)
}
defer cli.Close()
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
_, err = cli.Put(ctx, "key", "value")
cancel()
if err != nil {
panic(err)
}
fmt.Println("Key set successfully")
}
Upgrade
Version history
3.6.12latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.