Grpc-gateway: Cannot download 1.8.0 with modules

Created on 1 Mar 2019  ·  6Comments  ·  Source: grpc-ecosystem/grpc-gateway

Well, I just tried to update my project's dependencies, and things broke apart.
Seems like its not possible to get grpc-gateway at the moment:

Steps you follow to reproduce the error:

$ go get -u github.com/grpc-ecosystem/grpc-gateway
go: github.com/go-resty/[email protected]: parsing go.mod: unexpected module path "gopkg.in/resty.v1"
go: finding golang.org/x/sys latest
go: finding golang.org/x/net latest
go get: error loading module requirements

FYI, go get github.com/grpc-ecosystem/[email protected] is just as broken.

What did you expect to happen instead:

Work?

What's your theory on why it isn't working:

grpc-gateway is using the wrong import path - its seems the replace directive in go.mod does not propagate properly?

https://github.com/go-resty/resty#installation
https://github.com/go-resty/resty/issues/230

Not directly related issue, but a discussion and reference for impact of "unexpected module path":
https://github.com/golang/lint/issues/436

EDIT: I was a bit fast on naming the issue - please correct as seen fit.

bug help wanted

Most helpful comment

I've confirmed this is working with both v1.8.1-pre1 and v1.8.1. Thanks for raising this issue.

All 6 comments

Argh, sorry about this. I figured this was working since the Go mod things we're running in CI didn't throw up any errors. Do you have any ideas for fixing this?

Well, there is two things.

First, is the question if the replace directive should propagate - I am not sure, as the go module documentation is not sufficiently clear about this (imo). However, I have a strong sense they don't. See the last paragraph here (emphasis by me):

exclude and replace directives only operate on the current (“main”) module. exclude and replace directives in modules other than the main module are ignored when building the main module. The replace and exclude statements therefore allow the main module complete control over its own build, without also being subject to complete control by dependencies. (See FAQ below for discussion of when to use a replace directive).

So, as how to fix this.... The only thing I can think of then is to go search&replace and fix the import paths everywhere :/ Option B might be to use v2 of resty, but I have no insight of the state of that version (as its still in development).

We've long discussed replacing the OpenAPI generator we use which is what is causing this import dependency - none of the runtime actually depends on resty. So that's another option. I'll try and work on this tomorrow and see what I can find. If this is blocking you right now and you find a solution, please open a PR and I'd be happy to review it.

Thanks, no worries ;-)

FYI, I totally forgot to mention how to workaround this, if someone is seriously blocked by this: As mentioned in linked resty issue above, you can use the same replace directive in your go.mod depending on grpc-gateway (either directly or indirectly).

This was closed a bit prematurely, but please test https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v1.8.1-pre1 and see if that fixes it. Once someone has confirmed this is working I will prepare v1.8.1 proper and close this issue.

I've confirmed this is working with both v1.8.1-pre1 and v1.8.1. Thanks for raising this issue.

Was this page helpful?
0 / 5 - 0 ratings