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

vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption #12181

Closed
frodriguez-sr opened this issue Jul 29, 2020 · 5 comments

Comments

@frodriguez-sr
Copy link

There's an issue when try to vendoring the client

package main
import (
	"context"
	"flag"
	"fmt"
	"log"
	"time"

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

func main() {
	var name = flag.String("name", "", "give a name")
	flag.Parse() // Create a etcd client
	cli, err := clientv3.New(clientv3.Config{Endpoints: []string{"localhost:2379"}})
	if err != nil {
		log.Fatal(err)
	}
	defer cli.Close() // create a sessions to aqcuire a lock
	s, _ := concurrency.NewSession(cli)
	defer s.Close()
	l := concurrency.NewMutex(s, "/distributed-lock/")
	ctx := context.Background() // acquire lock (or wait to have it)
	if err := l.Lock(ctx); err != nil {
		log.Fatal("cannot get lock")
	}
	fmt.Println("acquired lock for ", *name)
	fmt.Println("Do some work in", *name)
	time.Sleep(5 * time.Second)
	if err := l.Unlock(ctx); err != nil {
		log.Fatal(err)
	}
	fmt.Println("released lock for ", *name)
}

Works when I run
go run main.go -name first

But at the time to vendoring it has the same issue
go mod init && go mod tidy
and then

I got

go: src.srconnect.io/frodriguez/etcd_poc imports
        go.etcd.io/etcd/clientv3 tested by
        go.etcd.io/etcd/clientv3.test imports
        github.com/coreos/etcd/auth imports
        github.com/coreos/etcd/mvcc/backend imports
        github.com/coreos/bbolt: github.com/coreos/[email protected]: parsing go.mod:
        module declares its path as: go.etcd.io/bbolt
                but was required as: github.com/coreos/bbolt

If I run
go mod vendor
and then
go run -mod=vendor main.go -name first

I get

# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
vendor/github.com/coreos/etcd/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
vendor/github.com/coreos/etcd/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
vendor/github.com/coreos/etcd/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

Looks like some dependencies are broken or needs to be updated

@cfc4n
Copy link
Contributor

cfc4n commented Jul 29, 2020

go get go.etcd.io/etcd/[email protected]

via : #12068

@frodriguez-sr
Copy link
Author

@cfc4n

-> go get -v go.etcd.io/etcd/[email protected]       
get "go.etcd.io/etcd/clientv3": found meta tag get.metaImport{Prefix:"go.etcd.io/etcd", VCS:"git", RepoRoot:"https:/etcd-io/etcd"} at //go.etcd.io/etcd/clientv3?go-get=1
get "go.etcd.io/etcd": found meta tag get.metaImport{Prefix:"go.etcd.io/etcd", VCS:"git", RepoRoot:"https:/etcd-io/etcd"} at //go.etcd.io/etcd?go-get=1
get "go.etcd.io/etcd/clientv3": verifying non-authoritative meta tag
go get go.etcd.io/etcd/[email protected]: go.etcd.io/[email protected]: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3

@cfc4n
Copy link
Contributor

cfc4n commented Jul 30, 2020

use command go get go.etcd.io/etcd/clientv3@4873f5516

cfc4n@cnxct$: ~/Project/golang/gotest/src/etcd_clientv3                                                (11:22:13)
$ GOPROXY="" go get go.etcd.io/etcd/clientv3@4873f5516
go: found go.etcd.io/etcd/clientv3 in go.etcd.io/etcd v0.5.0-alpha.5.0.20200716221548-4873f5516bd9
cfc4n@cnxct$: ~/Project/golang/gotest/src/etcd_clientv3                                                (11:22:18)
$ go mod tidy
cfc4n@cnxct$: ~/Project/golang/gotest/src/etcd_clientv3                                                (11:22:26)
$ cat go.mod
module etcd_clientv3

go 1.14

require go.etcd.io/etcd v0.5.0-alpha.5.0.20200716221548-4873f5516bd9

@frodriguez-sr
Copy link
Author

I tried with a replacement of the grpc library.
I made this and worked fine

replace (
        github.com/coreos/etcd => github.com/coreos/etcd v3.3.10+incompatible
        google.golang.org/grpc v1.30.0 => google.golang.org/grpc v1.27.0
)

Then
go get -v
go mod vendor
go run -mod=vendor main.go -name first
And worked fine

Thanks for the help

@oldthreefeng
Copy link

i just change the require. use tag v3.4.3 to slove. thanks for this issue.

require (
	go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738
)

forging2012 added a commit to forging2012/etcd that referenced this issue Jun 17, 2021
There are many developers on the web, confused by how to install etcd v3 for the development of go project.

A number of similar errors were encountered, as follows:
etcd-io#13108

```
➜  ~ go version
go version go1.16.5 darwin/amd64

➜  ~  go get go.etcd.io/etcd/clientv3

go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
# github.com/coreos/etcd/clientv3/balancer/picker
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
```

There are many examples of confusion here:

- etcd-io#12577
- etcd-io#12181
- etcd-io#12068
- etcd-io#11931
......

So, As suggested by  @lilic , I submitted Readme update.
forging2012 added a commit to forging2012/etcd that referenced this issue Jun 17, 2021
There are many developers on the web, confused by how to install etcd v3 for the development of go project.

A number of similar errors were encountered, as follows:
etcd-io#13108

```
➜  ~ go version
go version go1.16.5 darwin/amd64

➜  ~  go get go.etcd.io/etcd/clientv3

go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
# github.com/coreos/etcd/clientv3/balancer/picker
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
```

There are many examples of confusion here:

- etcd-io#12577
- etcd-io#12181
- etcd-io#12068
- etcd-io#11931
......

So, As suggested by  @lilic , I submitted Readme update.
wilsonwang371 pushed a commit to wilsonwang371/etcd that referenced this issue Oct 29, 2021
There are many developers on the web, confused by how to install etcd v3 for the development of go project.

A number of similar errors were encountered, as follows:
etcd-io#13108

```
➜  ~ go version
go version go1.16.5 darwin/amd64

➜  ~  go get go.etcd.io/etcd/clientv3

go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
# github.com/coreos/etcd/clientv3/balancer/picker
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
```

There are many examples of confusion here:

- etcd-io#12577
- etcd-io#12181
- etcd-io#12068
- etcd-io#11931
......

So, As suggested by  @lilic , I submitted Readme update.
wilsonwang371 pushed a commit to wilsonwang371/etcd that referenced this issue Oct 29, 2021
There are many developers on the web, confused by how to install etcd v3 for the development of go project.

A number of similar errors were encountered, as follows:
etcd-io#13108

```
➜  ~ go version
go version go1.16.5 darwin/amd64

➜  ~  go get go.etcd.io/etcd/clientv3

go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
# github.com/coreos/etcd/clientv3/balancer/picker
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
```

There are many examples of confusion here:

- etcd-io#12577
- etcd-io#12181
- etcd-io#12068
- etcd-io#11931
......

So, As suggested by  @lilic , I submitted Readme update.
wilsonwang371 pushed a commit to wilsonwang371/etcd that referenced this issue Nov 3, 2021
There are many developers on the web, confused by how to install etcd v3 for the development of go project.

A number of similar errors were encountered, as follows:
etcd-io#13108

```
➜  ~ go version
go version go1.16.5 darwin/amd64

➜  ~  go get go.etcd.io/etcd/clientv3

go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
# github.com/coreos/etcd/clientv3/balancer/picker
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
```

There are many examples of confusion here:

- etcd-io#12577
- etcd-io#12181
- etcd-io#12068
- etcd-io#11931
......

So, As suggested by  @lilic , I submitted Readme update.
wilsonwang371 pushed a commit to wilsonwang371/etcd that referenced this issue Nov 3, 2021
There are many developers on the web, confused by how to install etcd v3 for the development of go project.

A number of similar errors were encountered, as follows:
etcd-io#13108

```
➜  ~ go version
go version go1.16.5 darwin/amd64

➜  ~  go get go.etcd.io/etcd/clientv3

go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
# github.com/coreos/etcd/clientv3/balancer/picker
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/[email protected]+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
```

There are many examples of confusion here:

- etcd-io#12577
- etcd-io#12181
- etcd-io#12068
- etcd-io#11931
......

So, As suggested by  @lilic , I submitted Readme update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants