Go mod x dependencies

#1

Hi folks.

I’m trying to build a project which uses (imports) Istio code. I’m [trying to] using go mod as well.
Because Istio code has some dependencies that do not belong to proper external repos (like https://github.com/istio/istio/blob/dcd1258aecd8f32912ed56c1730b3f515bb282c6/go.mod#L5) it’s been hard to build ‘downstream’ code that relies on Istio code.

In my app I tried to add something like this into my go.mod file:
replace cloud.google.com/go/contextgraph/apiv1alpha1 => istio.io/mixer/adapter/stackdriver/vendor/cloud.google.com/go/contextgraph/apiv1alpha1 v0.0.0-20190509020454-206bd439423a

But build fails with:
go: istio.io/mixer/adapter/stackdriver/vendor/cloud.google.com/go/contextgraph/apiv1alpha1@v0.0.0-20190509020454-206bd439423a: unrecognized import path "istio.io/mixer/adapter/stackdriver/vendor/cloud.google.com/go/contextgraph/apiv1alpha1" (parse https://istio.io/mixer/adapter/stackdriver/vendor/cloud.google.com/go/contextgraph/apiv1alpha1?go-get=1: no go-import meta tags ())

So, do you folks have any suggestions on how to workaround this? Or even a proper way to fix that? Like having this contextgraph code properly imported in some upstream project?

Thanks.

#2

cc @Pengyuan_Bian

The suggestion to move this code to a separate repo (like we do with https://github.com/istio/gogo-genproto) seems reasonable. This appears to be generated code that did not make it to the public version of cloud.google.com yet.
I think moving it to another repo should make it easier to for downstream projects to consume istio.

What do you think Peter?

#3

Sounds good to me. I don’t see any reason to keep that code in istio/istio.