azure-event-hubs-go icon indicating copy to clipboard operation
azure-event-hubs-go copied to clipboard

Examples not usable in Go-module because of AutoRest

Open unclearParadigm opened this issue 6 years ago • 5 comments

Expected Behavior

creating a simple Go-Module should work like this, right?

mkdir testProject
cd testProject
go mod init someModule
touch main.go
# Copy contents of "Receive with EPH"-Example from README into main.go
go build

Actual Behavior

Build fails because of ambigous autorest-versions (0.3.0 and 12.0.0)

ambiguous import: found github.com/Azure/go-autorest/autorest in multiple modules:
	github.com/Azure/go-autorest v12.0.0+incompatible (/home/rare/go/pkg/mod/github.com/!azure/[email protected]+incompatible/autorest)
	github.com/Azure/go-autorest/autorest v0.3.0 (/home/rare/go/pkg/mod/github.com/!azure/go-autorest/[email protected])

Environment

  • OS: Fedora 29
  • Go version: 1.12.6

unclearParadigm avatar Jun 30 '19 07:06 unclearParadigm

hmm... I wonder if a go mod tidy before go build would fix everything up.

devigned avatar Jul 08 '19 20:07 devigned

@devigned Nope it doesn't, it's caused by using a previous non go.mod version of autorest, see here:

  • https://github.com/Azure/go-autorest/issues/414
  • https://github.com/kubernetes/client-go/issues/628

The only way to fix this as a user of the library right now is adding a replace directive which is really not a good solution. Could you please update the dependencies of your library? Thanks!

elsesiy avatar Aug 26 '19 22:08 elsesiy

I experienced the same issue while developing a service using this lib. @elsesiy, I've basically done the exact same thing using the replace directive. It's nasty but at least it works.

hoenirvili avatar Sep 13 '19 10:09 hoenirvili

The same change that was made in https://github.com/Azure/azure-amqp-common-go/pull/39 (namely, swapping out the base go-autorest package with its individual subpackages) should do the trick in the go.mod here too. Happy to post a PR to do this if needed.

princjef avatar Oct 25 '19 20:10 princjef

I took a stab at this but it looks like the underlying Event Hubs package pulled from the azure-sdk-for-go project also pulls in the same go-autorest dependency chain, so it doesn't look like this can be done until https://github.com/Azure/azure-sdk-for-go/issues/2993 is resolved

princjef avatar Oct 28 '19 17:10 princjef