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

go get fails in coreos/etcd with undefined: resolver.BuildOption #11931

Closed
dwschulze opened this issue May 22, 2020 · 27 comments
Closed

go get fails in coreos/etcd with undefined: resolver.BuildOption #11931

dwschulze opened this issue May 22, 2020 · 27 comments
Labels

Comments

@dwschulze
Copy link

Following this example which I upgraded to use go-micro v2. When I run go get -u I get this error:

go: finding gopkg.in/tomb.v1 latest
# github.com/coreos/etcd/clientv3/balancer/picker
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
../../../../../go3p/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption

This looks like an error in coreos/etcd v 3.3.22. Here is my go.mod file:

require (
	github.com/coreos/etcd v3.3.22+incompatible // indirect
	github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
	github.com/fsnotify/fsnotify v1.4.9 // indirect
	github.com/gogo/protobuf v1.3.1 // indirect
	github.com/golang/protobuf v1.4.2
	github.com/imdario/mergo v0.3.9 // indirect
	github.com/micro/go-micro/v2 v2.7.0
	github.com/miekg/dns v1.1.29 // indirect
	github.com/nats-io/nats.go v1.10.0 // indirect
	go.uber.org/zap v1.15.0 // indirect
	golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect
	golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
	golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect
	golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
	golang.org/x/tools v0.0.0-20200521211927-2b542361a4fc // indirect
	google.golang.org/genproto v0.0.0-20200521103424-e9a78aa275b7 // indirect
	google.golang.org/grpc v1.29.1 // indirect
	gopkg.in/yaml.v2 v2.3.0 // indirect
	honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)

@sebastianBD95
Copy link

I have the same problem :(

@marcsauter
Copy link

Same here:

$ go version
go version go1.14.3 linux/amd64
$ go clean -modcache
$ go get go.etcd.io/etcd/clientv3
go: downloading go.etcd.io/etcd v0.5.0-alpha.5
go: downloading go.etcd.io/etcd v3.3.22+incompatible
go: found go.etcd.io/etcd/clientv3 in go.etcd.io/etcd v3.3.22+incompatible
go: finding module for package google.golang.org/grpc/codes
go: finding module for package google.golang.org/grpc/grpclog
go: finding module for package github.com/coreos/pkg/capnslog
go: finding module for package github.com/coreos/etcd/pkg/logutil
go: finding module for package github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes
go: finding module for package github.com/coreos/etcd/auth/authpb
go: finding module for package google.golang.org/grpc/metadata
go: finding module for package github.com/google/uuid
go: finding module for package github.com/coreos/etcd/mvcc/mvccpb
go: finding module for package google.golang.org/grpc/keepalive
go: downloading github.com/coreos/etcd v0.5.0-alpha.5
go: downloading google.golang.org/grpc v1.29.1
go: downloading github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
go: downloading github.com/google/uuid v1.1.1
go: downloading github.com/coreos/etcd v3.3.22+incompatible
go: finding module for package google.golang.org/grpc/status
go: finding module for package google.golang.org/grpc/credentials
go: finding module for package github.com/coreos/etcd/clientv3/credentials
go: finding module for package github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
go: finding module for package github.com/coreos/etcd/clientv3/balancer/picker
go: finding module for package github.com/coreos/etcd/pkg/types
go: finding module for package github.com/coreos/etcd/clientv3/balancer
go: finding module for package go.uber.org/zap
go: downloading go.uber.org/zap v1.15.0
go: finding module for package github.com/coreos/etcd/version
go: finding module for package google.golang.org/grpc
go: finding module for package github.com/coreos/etcd/etcdserver/etcdserverpb
go: found github.com/coreos/etcd/auth/authpb in github.com/coreos/etcd v3.3.22+incompatible
go: found github.com/coreos/pkg/capnslog in github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
go: found github.com/google/uuid in github.com/google/uuid v1.1.1
go: found go.uber.org/zap in go.uber.org/zap v1.15.0
go: found google.golang.org/grpc in google.golang.org/grpc v1.29.1
go: finding module for package github.com/coreos/go-systemd/journal
go: finding module for package github.com/gogo/protobuf/gogoproto
go: downloading google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
go: downloading golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: downloading golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: downloading go.uber.org/multierr v1.5.0
go: downloading github.com/golang/protobuf v1.3.3
go: finding module for package github.com/coreos/go-semver/semver
go: downloading github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: downloading github.com/gogo/protobuf v1.3.1
go: downloading github.com/coreos/go-semver v0.3.0
go: downloading go.uber.org/atomic v1.6.0
go: downloading golang.org/x/text v0.3.0
go: found github.com/gogo/protobuf/gogoproto in github.com/gogo/protobuf v1.3.1
go: found github.com/coreos/go-systemd/journal in github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: found github.com/coreos/go-semver/semver in github.com/coreos/go-semver v0.3.0
# github.com/coreos/etcd/clientv3/balancer/picker
/home/sauterm/golang/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
/home/sauterm/golang/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
/home/sauterm/golang/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
/home/sauterm/golang/pkg/mod/github.com/coreos/etcd@v3.3.22+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption

@dfawley
Copy link

dfawley commented May 26, 2020

Looks like etcd is still using an experimental grpc-go API that was marked as deprecated and announced for deletion 6 months ago:

grpc/grpc-go#3180

https://github.com/etcd-io/etcd/blob/master/clientv3/balancer/picker/roundrobin_balanced.go#L55

Someone will need to migrate this to the new API, although that doesn't fix the long-term problem that it will again be relying upon an experimental API, also subject to further changes.

@dfawley
Copy link

dfawley commented May 26, 2020

FWIW the fixes to the short-term problem should be quite simple. A few things were renamed (BuildOption -> BuildOptions, ResolveNowOption -> ResolveNowOptions, PickOptions -> PickInfo), and the signature of Pick was changed slightly from the original API.

@mengqiy
Copy link

mengqiy commented May 27, 2020

cc: @jpbetz @jingyih

@sebastianBD95
Copy link

In my case what i did was to get only the modules that i am using in my project with just go get without using the flag -u and that solve my problem

@utrack
Copy link

utrack commented May 27, 2020

See #11721 - there's a fork that works with latest gRPC.
PR #11564 fixes that problem, not exactly sure why it still hadn't been picked for 3.3 release branch.
v3.4 already has that fix.

@mengqiy
Copy link

mengqiy commented May 27, 2020

Can we cherrypick the fix to v3.3?

@mattrasband
Copy link

As a workaround locally, I just did go get google.golang.org/grpc@v1.26.0 - that updated the go.mod and builds are working again.

@utrack
Copy link

utrack commented Jun 3, 2020

Be careful - grpc >= v1.26.0, <1.27.1 has a nasty bug where temporary failure of DNS resolution will bring your client down until it is restarted. See grpc/grpc-go#3353

@mattrasband
Copy link

Thank you @utrack - that's good to know.

@corpix
Copy link

corpix commented Jul 9, 2020

Dang it. Go starts to remind me a node.js with outdated stuff which just don't work anymore 🤦‍♂️

@corpix
Copy link

corpix commented Jul 9, 2020

@arges proposed a fix in #11580 but it has not received any attention and was closed

UPD: if you use vendoring here is how to apply the patch from pull request

go mod download
go mod vendor
cd vendor/github.com/coreos/etcd/
curl -Ls https://github.com/etcd-io/etcd/pull/11580.patch | patch -p1
cd -

aaaaand... it will fail to compile because grpc api has changed. Dang it.

UPD2: to make clientv3 build I've made a separate patch (WARNING: I have no idea what I am doing, "I am just out for a walk") corpix@adb7dca (with support for grpc 1.30.x), apply it with:

cd vendor/github.com/coreos/etcd/
curl -Ls https://github.com/corpix/etcd/commit/adb7dcade831f698e657bf1ccab6c138be05fb84.patch | patch -p1
cd -

@fbens
Copy link

fbens commented Sep 15, 2020

go clean -modcache resolve my problem

@zbindenren
Copy link
Contributor

zbindenren commented Sep 22, 2020

go clean -modcache resolve my problem

This did not help. Only go get google.golang.org/grpc@v1.26.0 as mentioned above helps.

As long this bug exists, it is not possible to upgrade grpc.

@zbindenren
Copy link
Contributor

It seams this should be fixed with v3.5: #12124 (comment).

See also: #12124

@ratnadeepb
Copy link

Faced the same issue. The short term solution by @dfawley of changing the names locally helped. go build now succeeds. go mod tidy still fails with:

github.com/coreos/etcd/clientv3 tested by
        github.com/coreos/etcd/clientv3.test imports
        github.com/coreos/etcd/auth imports
        github.com/coreos/etcd/mvcc/backend imports
        github.com/coreos/bbolt: github.com/coreos/bbolt@v1.3.5: parsing go.mod:
        module declares its path as: go.etcd.io/bbolt
                but was required as: github.com/coreos/bbolt

Tried both go clean -modcache and go get google.golang.org/grpc@v1.26.0.

@stale
Copy link

stale bot commented Feb 28, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Feb 28, 2021
@stale stale bot closed this as completed Mar 21, 2021
@newhook
Copy link

newhook commented May 19, 2021

Any chance this will be fixed? As of May 19th it is still broken.

  newhook mkdir t1
➜  newhook cd t1
➜  t1 go mod init t1
go: creating new go.mod: module t1
➜  t1 go get go.etcd.io/etcd/clientv3    
go: downloading golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: downloading golang.org/x/net v0.0.0-20201021035429-f5854403a974
go: downloading golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f
go: downloading golang.org/x/text v0.3.3
# github.com/coreos/etcd/clientv3/balancer/resolver/endpoint
../../../../pkg/mod/github.com/coreos/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
../../../../pkg/mod/github.com/coreos/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:182:31: undefined: resolver.ResolveNowOption
# github.com/coreos/etcd/clientv3/balancer/picker
../../../../pkg/mod/github.com/coreos/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
../../../../pkg/mod/github.com/coreos/etcd@v3.3.25+incompatible/clientv3/balancer/picker/roundrobin_balanced.go:55:54: undefined: balancer.PickOptions

@ptabor
Copy link
Contributor

ptabor commented May 19, 2021

Please try:

go get go.etcd.io/etcd/client/v3 

@newhook
Copy link

newhook commented May 19, 2021

Thanks! That works. However, v3.5.0-beta.3 doesn't really seem like something I feel comfortable turning loose on our production systems.

@ptabor
Copy link
Contributor

ptabor commented May 19, 2021

Please test and provide feedback. The more issues we detect early the higher chances good GA will land in 2-3 weeks.

@newhook
Copy link

newhook commented May 19, 2021

Will do. Thanks for helping and thanks for your work.

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/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/picker/err.go:37:44: undefined: balancer.PickOptions
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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/etcd@v3.3.25+incompatible/clientv3/balancer/resolver/endpoint/endpoint.go:114:78: undefined: resolver.BuildOption
go/pkg/mod/github.com/coreos/etcd@v3.3.25+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.
@lishaoshu1240
Copy link

lishaoshu1240 commented Nov 18, 2021

i have resolve it.
1、first: open the go.mod, add this line :
replace ( google.golang.org/grpc => google.golang.org/grpc v1.26.0)
2、then:
go get -u -v go.etcd.io/etcd

@sunqb
Copy link

sunqb commented Nov 29, 2021

这个bug到现在都还没解决?

@cph999
Copy link

cph999 commented Oct 9, 2022

GOROOT=D:\go #gosetup
GOPATH=D:\go;D:\project #gosetup
D:\go\bin\go.exe build -o C:\Users\cph\AppData\Local\Temp\GoLand___go_build_go_micro.exe go-micro #gosetup

github.com/coreos/etcd/clientv3/balancer/resolver/endpoint

D:\go\pkg\mod\github.com\coreos\etcd@v3.3.17+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:114:87: undefined: resolver.BuildOption
D:\go\pkg\mod\github.com\coreos\etcd@v3.3.17+incompatible\clientv3\balancer\resolver\endpoint\endpoint.go:182:40: undefined: resolver.ResolveNowOption

github.com/coreos/etcd/clientv3/balancer/picker

D:\go\pkg\mod\github.com\coreos\etcd@v3.3.17+incompatible\clientv3\balancer\picker\err.go:37:53: undefined: balancer.PickOptions
D:\go\pkg\mod\github.com\coreos\etcd@v3.3.17+incompatible\clientv3\balancer\picker\roundrobin_balanced.go:55:63: undefined: balancer.PickOptions

Compilation finished with exit code 2

@nightbarron
Copy link

change it to go.etcd.io/etcd/client/v3 instead of go.etcd.io/etcd/clientv3

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

No branches or pull requests