Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected ":" in connection url #10249

Closed
ghost opened this issue Nov 9, 2018 · 5 comments
Closed

Unexpected ":" in connection url #10249

ghost opened this issue Nov 9, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented Nov 9, 2018

Details

etcd Version: 3.3.10
Git SHA: GitNotFound
Go Version: go1.11.1
Go OS/Arch: darwin/amd64

Problem (unexpect colons)

image
image

@hexfusion
Copy link
Contributor

etcd Version: 3.3.10
Git SHA: GitNotFound
Go Version: go1.11.1
Go OS/Arch: darwin/amd64

@hoobean1996 I assume you are using release assets to test? https://github.com/etcd-io/etcd/releases

Could you outline full steps to reproduce along with your go version?.

@ghost
Copy link
Author

ghost commented Nov 12, 2018

etcd Version: 3.3.10
Git SHA: GitNotFound
Go Version: go1.11.1
Go OS/Arch: darwin/amd64

@hoobean1996 I assume you are using release assets to test? https://github.com/etcd-io/etcd/releases

Could you outline full steps to reproduce along with your go version?.

Thanks
I Used 'brew install etcd' to install etcd ,and the details are
etcd Version: 3.3.10 Git SHA: GitNotFound Go Version: go1.11.1 Go OS/Arch: darwin/amd64
in my Go program, I want to connect etcd by etcd/ClientV3,
if I use '127.0.0.1:2378' without http://, it is ok, no unexpected ":".
if I use http://127.0.0.1:2379,the test code will panic with unexpect ":" .

Sample:
image
image

I follow the docs to write test demo,but it failed
I miss any configuration ? thanks

@ghost
Copy link
Author

ghost commented Nov 15, 2018

I use HTTP to work with etcd server, but the etcdClient still not worked

@hexfusion
Copy link
Contributor

@hoobean1996 I cannot reproduce, here are my steps with a slightly modified example from GoDoc https://godoc.org/go.etcd.io/etcd/clientv3#example-KV--Put

brew install dep
mkdir $GOPATH/src/hexfusion/clientv3_demo
cd !$
dep init
go run .

put sample_key success!
cluster_id:14841639068965178418 member_id:10276657743932975437 revision:12 raft_term:3
package main

import (
        "context"
        "fmt"
        "log"
        "time"

        "go.etcd.io/etcd/clientv3"
)

func main() {
        requestTimeout := 5 * time.Second
        cli, err := clientv3.New(clientv3.Config{
                Endpoints:   []string{"http://127.0.0.1:2379"},
                DialTimeout: 5 * time.Second,
        })
        if err != nil {
                log.Fatal(err)
        }
        defer cli.Close()

        key := "sample_key"
        value := "sample_value"
        ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
        resp, rerr := cli.Put(ctx, key, value)
        cancel()
        if rerr != nil {
                log.Fatal(rerr)
        }
        fmt.Printf("put %s success!\n%v\n", key, resp.Header)

}

dep vendors reasonable versions of dependencies which might of been your issue?

@ghost
Copy link
Author

ghost commented Nov 17, 2018

Thank you very much !

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant