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

ambiguous import when installing sentry-go for gin #941

Closed
dvigueras opened this issue Dec 30, 2024 · 3 comments
Closed

ambiguous import when installing sentry-go for gin #941

dvigueras opened this issue Dec 30, 2024 · 3 comments

Comments

@dvigueras
Copy link

dvigueras commented Dec 30, 2024

When running the following command:

go get github.com/getsentry/sentry-go/gin

I get:

go: github.com/getsentry/sentry-go/gin: ambiguous import: found package github.com/getsentry/sentry-go/gin in multiple modules:
	github.com/getsentry/sentry-go v0.30.0 (/Users/daniel/.go/pkg/mod/github.com/getsentry/[email protected]/gin)
	github.com/getsentry/sentry-go/gin v0.0.0-20241220173835-ade504db7b4e (/Users/daniel/.go/pkg/mod/github.com/getsentry/sentry-go/[email protected])
$ go version
go version go1.23.3 darwin/arm64

How can I solve it?

If I put the sample code in my project and then run go mod tidy it also happens. Thanks

@cleptric
Copy link
Member

Thanks for letting us know about this. Our usage of replace github.com/getsentry/sentry-go => ../ causes this problem, even without tagging a new version. https://stackoverflow.com/a/71984158/18924316 describes the issue in great detail.

Sorry for that, I wasn't really aware of this until today. For our Otel integration, which was our first test bed for splitting the repo into multiple sub-modules, we didn't run into this as we tell people to install both the base SDK and the Otel module at the same time.

While we reverted the commit that introduced the new modules for now, the issue seems to persist, and I'm currently not entirely sure why.

The best workaround for now is to install the gin integration alongside the base SDK.

go get github.com/getsentry/sentry-go \
       github.com/getsentry/sentry-go/gin

@dvigueras
Copy link
Author

Thanks @cleptric

Doing:

go get github.com/getsentry/sentry-go \
       github.com/getsentry/sentry-go/gin

solved the problem.

go: downloading github.com/getsentry/sentry-go/gin v0.0.0-20241230225403-109fca191e09
go: added github.com/getsentry/sentry-go v0.30.0

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 31, 2024
@cleptric
Copy link
Member

cleptric commented Jan 2, 2025

This was fixed in v.0.31.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants