fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.87k stars 507 forks source link

Update install for go get/go install in README #202

Open corylanou opened 3 years ago

corylanou commented 3 years ago

If you try to install the tool, you currently get:

$ go install github.com/fullstorydev/grpcurl/cmd/grpcurl
go: finding github.com/cncf/udpa/go latest
build github.com/fullstorydev/grpcurl/cmd/grpcurl: cannot load github.com/cncf/udpa/go/udpa/core/v1: module github.com/cncf/udpa/go@latest (v0.0.0-20201120205902-5459f2c99403) found, but does not contain package github.com/cncf/udpa/go/udpa/core/v1

I tried using the latest tagged version as well via go get, but the same issue exists there as well. This is a downstream mod issue with https://github.com/cncf/udpa not apparently having a version tag, but they have since updated that it appears.

$ go get -u -v github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.7.0
go: finding github.com v1.7.0
go: finding github.com/fullstorydev/grpcurl/cmd/grpcurl v1.7.0
go: finding github.com/fullstorydev/grpcurl/cmd v1.7.0
go: finding github.com/fullstorydev v1.7.0
go: finding github.com/cncf/udpa/go latest
go: finding google.golang.org/genproto latest
go: finding golang.org/x/net latest
go: finding golang.org/x/sys latest
go: finding golang.org/x/oauth2 latest
build github.com/fullstorydev/grpcurl/cmd/grpcurl: cannot load github.com/cncf/udpa/go/udpa/core/v1: module github.com/cncf/udpa/go@latest (v0.0.0-20201120205902-5459f2c99403) found, but does not contain package github.com/cncf/udpa/go/udpa/core/v1
corylanou commented 3 years ago

so apparently, this occurs if you do the following:

  1. From within a project that has a go.mod file
  2. Run the following command go get -u -v github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.7.0
  3. Then run go install github.com/fullstorydev/grpcurl/cmd/grpcurl

Running go mod tidy however, after each step, will actually result in success. I know this isn't your fault, but a fault of how go mods works (hopefully 1.16 fixes this with the new explicit install command). However, it might be worth updating install directions on the README.md to call this out explicity.

jhump commented 3 years ago

Yep, I am aware of the breakage; it impacts grpcui in the same way.

The problem is that running go get or go install when you're not in a workspace will default to GOPATH mode, and just get latest of all dependencies instead of the pinned one. Before updating the README, I'm waiting to see what the right ultimate solution will be. My hope is that this is temporary, caused by an incompatibility/breakage in the downstream cncf/udpa repo, which could be fixed by an update to the gRPC repo (which is what uses that repo and pins a particular past version).