Skip to content

Instantly share code, notes, and snippets.

@xiachengjia
Created December 23, 2018 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiachengjia/542ec42b7d2958744292bbc7d25fd7a5 to your computer and use it in GitHub Desktop.
Save xiachengjia/542ec42b7d2958744292bbc7d25fd7a5 to your computer and use it in GitHub Desktop.
go module bug with github.com/ugorji/go
// $ ./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")
}
@xiachengjia
Copy link
Author

when I try to connect my old server etcd , and print it's Version, client will block

$ ./etcd -version
etcd Version: 3.2.0-rc.0
Git SHA: 7e6d876
Go Version: go1.8.1
Go OS/Arch: linux/amd64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment