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

Compile breaks #8548

Closed
ake-persson opened this issue Sep 12, 2017 · 21 comments
Closed

Compile breaks #8548

ake-persson opened this issue Sep 12, 2017 · 21 comments

Comments

@ake-persson
Copy link

ake-persson commented Sep 12, 2017

Bug reporting

There seems to be a dep. issue in the clientv3, when compiling I get the following error:

# github.com/coreos/etcd/clientv3
../../../../github.com/coreos/etcd/clientv3/client.go:336: undefined: metadata.NewContext
../../../../github.com/coreos/etcd/clientv3/lease.go:352: undefined: metadata.FromContext

Code:

package main

import (
	"log"
	"strconv"
	"strings"
	"time"

	etcd "github.com/coreos/etcd/clientv3"
	"github.com/docopt/docopt-go"
)

func main() {
	usage := `example

Usage:
  example [--peers=<peers>] [--timeout=<seconds>]
  example -h | --help
  example --version

Options:
  -h --help                     Show this screen.
  --version                     Show version.
  --peers=<peers>               Comma-delimited list of hosts in the cluster.
  --timeout=<seconds>           Connection timeout in seconds. [default: 30]
`

	args, err := docopt.Parse(usage, nil, true, "example 0.0.1", false)
	if err != nil {
		log.Fatalf("parse args: %v", err)
	}

	if args["--peers"] == nil {
		log.Fatalf("missing option: --peers")
	}

	tmout, err := strconv.Atoi(args["--timeout"].(string))
	if err != nil {
		log.Fatalf("strconv: %v", err)
	}

	cli, err := etcd.New(etcd.Config{
		Endpoints:   strings.Split(args["--peers"].(string), ","),
		DialTimeout: time.Duration(tmout) * time.Second,
	})
	if err != nil {
		log.Fatalf("etcd conn: %v", err)
	}

	defer cli.Close()
}
@ake-persson
Copy link
Author

This only affects v1.6.x of grpc or master branch. It works for v1.5.x branch.

@heyitsanthony
Copy link
Contributor

OK, grpc broke their API again. Thanks for the heads up.

@gyuho
Copy link
Contributor

gyuho commented Sep 13, 2017

@Mickep76 We've migrated our clientv3 to use incoming/outgoing context here #7896. So this should compile with etcd master branch. Can you try updating your etcd/clientv3 vendor with master and gRPC 1.5.x?

@ake-persson
Copy link
Author

@gyuo I get the following compile error with latest etcd and grpc.

# github.com/coreos/etcd/clientv3
../../../../github.com/coreos/etcd/clientv3/client.go:328: cannot use c.tokenCred (type *authTokenCredential) as type credentials.PerRPCCredentials in argument to grpc.WithPerRPCCredentials:
	*authTokenCredential does not implement credentials.PerRPCCredentials (wrong type for GetRequestMetadata method)
		have GetRequestMetadata("context".Context, ...string) (map[string]string, error)
		want GetRequestMetadata("golang.org/x/net/context".Context, ...string) (map[string]string, error)
../../../../github.com/coreos/etcd/clientv3/client.go:381: cannot use client.balancer (type *simpleBalancer) as type grpc.Balancer in argument to grpc.WithBalancer:
	*simpleBalancer does not implement grpc.Balancer (wrong type for Get method)
		have Get("context".Context, grpc.BalancerGetOptions) (grpc.Address, func(), error)
		want Get("golang.org/x/net/context".Context, grpc.BalancerGetOptions) (grpc.Address, func(), error)
../../../../github.com/coreos/etcd/clientv3/retry.go:97: cannot use *retryKVClient literal (type *retryKVClient) as type etcdserverpb.KVClient in return argument:
	*retryKVClient does not implement etcdserverpb.KVClient (wrong type for Compact method)
		have Compact("context".Context, *etcdserverpb.CompactionRequest, ...grpc.CallOption) (*etcdserverpb.CompactionResponse, error)
		want Compact("golang.org/x/net/context".Context, *etcdserverpb.CompactionRequest, ...grpc.CallOption) (*etcdserverpb.CompactionResponse, error)
../../../../github.com/coreos/etcd/clientv3/retry.go:98: cannot use retryBasic (type *retryKVClient) as type etcdserverpb.KVClient in field value:
	*retryKVClient does not implement etcdserverpb.KVClient (wrong type for Compact method)
		have Compact("context".Context, *etcdserverpb.CompactionRequest, ...grpc.CallOption) (*etcdserverpb.CompactionResponse, error)
		want Compact("golang.org/x/net/context".Context, *etcdserverpb.CompactionRequest, ...grpc.CallOption) (*etcdserverpb.CompactionResponse, error)
../../../../github.com/coreos/etcd/clientv3/retry.go:163: cannot use retry (type *retryLeaseClient) as type etcdserverpb.LeaseClient in field value:
	*retryLeaseClient does not implement etcdserverpb.LeaseClient (wrong type for LeaseGrant method)
		have LeaseGrant("context".Context, *etcdserverpb.LeaseGrantRequest, ...grpc.CallOption) (*etcdserverpb.LeaseGrantResponse, error)
		want LeaseGrant("golang.org/x/net/context".Context, *etcdserverpb.LeaseGrantRequest, ...grpc.CallOption) (*etcdserverpb.LeaseGrantResponse, error)
../../../../github.com/coreos/etcd/clientv3/retry.go:163: cannot use *retryLeaseClient literal (type *retryLeaseClient) as type etcdserverpb.LeaseClient in return argument:
	*retryLeaseClient does not implement etcdserverpb.LeaseClient (wrong type for LeaseGrant method)
		have LeaseGrant("context".Context, *etcdserverpb.LeaseGrantRequest, ...grpc.CallOption) (*etcdserverpb.LeaseGrantResponse, error)
		want LeaseGrant("golang.org/x/net/context".Context, *etcdserverpb.LeaseGrantRequest, ...grpc.CallOption) (*etcdserverpb.LeaseGrantResponse, error)
../../../../github.com/coreos/etcd/clientv3/retry.go:190: cannot use retryClusterClient literal (type *retryClusterClient) as type etcdserverpb.ClusterClient in return argument:
	*retryClusterClient does not implement etcdserverpb.ClusterClient (wrong type for MemberAdd method)
		have MemberAdd("context".Context, *etcdserverpb.MemberAddRequest, ...grpc.CallOption) (*etcdserverpb.MemberAddResponse, error)
		want MemberAdd("golang.org/x/net/context".Context, *etcdserverpb.MemberAddRequest, ...grpc.CallOption) (*etcdserverpb.MemberAddResponse, error)
../../../../github.com/coreos/etcd/clientv3/retry.go:224: cannot use retryAuthClient literal (type *retryAuthClient) as type etcdserverpb.AuthClient in return argument:
	*retryAuthClient does not implement etcdserverpb.AuthClient (wrong type for AuthDisable method)
		have AuthDisable("context".Context, *etcdserverpb.AuthDisableRequest, ...grpc.CallOption) (*etcdserverpb.AuthDisableResponse, error)
		want AuthDisable("golang.org/x/net/context".Context, *etcdserverpb.AuthDisableRequest, ...grpc.CallOption) (*etcdserverpb.AuthDisableResponse, error)

Using v1.5.x branch I get the same error, so it's now broken for v1.5.x and v1.6.x of grpc and etcd master branch.

@ake-persson
Copy link
Author

For the moment I can compile with branch "release-3.2" for etcd and branch "v1.5.x" for grpc.

@gyuho
Copy link
Contributor

gyuho commented Sep 14, 2017

@Mickep76 For master branch, etcd requires Go 1.9.

@gyuho
Copy link
Contributor

gyuho commented Sep 19, 2017

@Mickep76 Ping?

@Iulian7
Copy link

Iulian7 commented Sep 20, 2017

For me it works with the etcd master branch and grpc 1.6.0

[[constraint]]
  branch = "master"
  name = "github.com/coreos/etcd"

[[constraint]]
  name = "google.golang.org/grpc"
  version = "1.6.0"

@gyuho
Copy link
Contributor

gyuho commented Sep 20, 2017

@Mickep76 Please reopen if you still have issues.

@gyuho gyuho closed this as completed Sep 20, 2017
@ake-persson
Copy link
Author

With go1.9 it builds out of the box. Might be wise to put a notice in the README.md.

Thx

@singhmal
Copy link

Guys, I am using grpc 1.6.0 and go 1.9 and etcd 3.2.9 fails to build. What do you suggest doing? Are you guys going to release grpc 1.6.0 compatible version in near future? I do not want to pull master etcd due to possibility of unstable changes.

Thanks

@gyuho
Copy link
Contributor

gyuho commented Oct 10, 2017

@singhmal etcd v3.2.x still uses grpc-go v1.2.1 and Go 1.8.4. https://github.com/coreos/etcd/blob/release-3.2/glide.yaml

@singhmal
Copy link

@gyuho Thanks for quick turnaround but I can not change my infrastructure to use older grpc-go or go. What do you suggest I should be doing?

@gyuho
Copy link
Contributor

gyuho commented Oct 11, 2017

Please wait until 3.3 release. There are still a lot of things to stabilize before releasing 3.3.

@singhmal
Copy link

Ahh I see, any ETA for 3.3 ? I will make do with master for the time being. Thanks a lot.

@gyuho
Copy link
Contributor

gyuho commented Oct 11, 2017

Please note that master branch is not stable.
We try to release 3.3 in a month or so.

@singhmal
Copy link

I am fully aware of master being unstable but I got no choice. I take the responsibility of the unstability.

@namgivu
Copy link

namgivu commented Oct 24, 2017

I try etcd v3.2.9 today with golang 1.9 and still getting the error

vendor/github.com/coreos/etcd/clientv3/client.go:336:9: undefined: metadata.NewContext
vendor/github.com/coreos/etcd/clientv3/lease.go:326:14: undefined: metadata.FromContext

@namgivu
Copy link

namgivu commented Oct 24, 2017

Using glide to hold etcd package to be at branch release-3.2 works for me.

import:
- package: github.com/coreos/etcd
  version: release-3.2

@drewlandis
Copy link

I'm getting the same error as above. Any update on a release date for v3.3?

@gyuho
Copy link
Contributor

gyuho commented Oct 24, 2017

@drewlandis We still have many pending issues. And also planning another gRPC dependency upgrade.

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

7 participants