Created
December 23, 2018 07:04
-
-
Save xiachengjia/542ec42b7d2958744292bbc7d25fd7a5 to your computer and use it in GitHub Desktop.
go module bug with github.com/ugorji/go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ ./bin/etcd -version | |
// etcd Version: 3.3.0+git | |
// Git SHA: 9113019 | |
// Go Version: go1.11.4 | |
// Go OS/Arch: linux/amd64 | |
// # run etcd with default | |
// $ ./bin/etcd | |
// $ export GO111MODULE=on | |
// $ go mod init main | |
// $ go get github.com/ugorji/go/codec@none | |
// $ go get github.com/ugorji/go@v1.1.1 | |
// $ go build ./... | |
// $ ./main | |
package main | |
import ( | |
"context" | |
"fmt" | |
"go.etcd.io/etcd/client" | |
"os" | |
) | |
func main() { | |
c, err := client.New( | |
client.Config{ | |
Endpoints: []string{ | |
"http://localhost:2379", | |
}, | |
}) | |
if err != nil { | |
fmt.Println(err) | |
os.Exit(1) | |
} | |
v, err := c.GetVersion(context.Background()) | |
if err != nil { | |
fmt.Println(err) | |
os.Exit(1) | |
} | |
fmt.Println(v.Server, v.Cluster) | |
fmt.Println("ok") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when I try to connect my old server etcd , and print it's Version, client will block