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

Dependencies conflict while updates the sentry version to 0.3.1 #87

Closed
d0sdoc opened this issue Nov 15, 2019 · 7 comments · Fixed by #110
Closed

Dependencies conflict while updates the sentry version to 0.3.1 #87

d0sdoc opened this issue Nov 15, 2019 · 7 comments · Fixed by #110

Comments

@d0sdoc
Copy link

d0sdoc commented Nov 15, 2019

Hello everyone,
I've tried to update the sentry-go version to 0.3.1 and got an error:

build app: cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:
	github.com/ugorji/go v1.1.4 (/go/pkg/mod/github.com/ugorji/go@v1.1.4/codec)
	github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 (/go/pkg/mod/github.com/ugorji/go/codec@v0.0.0-20181204163529-d75b2dcb6bc8)

I've changed in go.mod of my project github.com/getsentry/sentry-go v0.3.0 to github.com/getsentry/sentry-go v0.3.1

Here are the ugorji entries in go.sum:

github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYyQWRjXWJEA9sS/c/pjvH++55Gr648=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=

go version is 1.13

@kamilogorek
Copy link
Contributor

This addition to go.mod should fix it:

replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43

from: https://github.com/getsentry/sentry-go/blob/master/go.mod

Although I thought it should be propagated to all the packages relaying on our go.mod :|
I'll try to sort this + #75 (comment) next week.

@rhcarvalho
Copy link
Contributor

For the record, I just realized this is one of those cases of multiple modules in one repo.


@kamilogorek like we were discussing in #79

https://github.com/ugorji/go/blob/master/go.mod
https://github.com/ugorji/go/blob/master/codec/go.mod

@rhcarvalho
Copy link
Contributor

Although I thought it should be propagated to all the packages relaying on our go.mod :|

@kamilogorek

https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive
"replace directives in modules other than the main module are ignored when building the main module"

We should not need to have a replace directive in sentry-go, because we are a library and not the main module. Let's see if we can get rid of that replace...

@rhcarvalho
Copy link
Contributor

Hi @d0sdoc do you still need any help? Were you able to fix the problem?

The only thing in sentry-go that pulls in github.com/ugorji/go/codec is the integration with github.com/gin-gonic/gin. Are you using gin in your program? What version?

go list -m github.com/gin-gonic/gin

I wrote a test program using Go modules and sentry-go v0.3.1 and gin v1.4.0 (the minimum required by sentry-go@v0.3.1) and could no reproduce the issue.

$ cat main.go
package main

import (
        "fmt"

        "github.com/getsentry/sentry-go"
        "github.com/gin-gonic/gin"
)

func main() {
        sentry.Init(sentry.ClientOptions{Debug: true})
        fmt.Println("hello", gin.BodyBytesKey)
}
$ go list -m github.com/gin-gonic/gin github.com/getsentry/sentry-go
github.com/gin-gonic/gin v1.4.0
github.com/getsentry/sentry-go v0.3.1
$ go version
go version go1.13.4 darwin/amd64

Please let me know if you have a repro or otherwise we can close this.

Thank you!

@rhcarvalho
Copy link
Contributor

Reference to issue in gin: gin-gonic/gin#1673
And in ugorji/go: ugorji/go#279, ugorji/go#299

@rhcarvalho
Copy link
Contributor

Okay, I found out why I could not reproduce the issue.

When installing dependencies on a clean, new, module I got a newer version of github.com/ugorji/go that has a fix for the inconsistency @d0sdoc observed.

module example

go 1.13

require (
	github.com/getsentry/sentry-go v0.3.1
	github.com/gin-gonic/gin v1.4.0
	github.com/golang/protobuf v1.3.2 // indirect
	github.com/json-iterator/go v1.1.8 // indirect
	github.com/ugorji/go v1.1.7 // indirect            <--------
	gopkg.in/yaml.v2 v2.2.7 // indirect
)

Removing the line marked above, or downgrading github.com/ugorji/go reproduces the original issue.

@d0sdoc apart from the replace directive suggested earlier, another solution I can propose is to bump the version of github.com/ugorji/go in your project:

go get -u github.com/ugorji/go@v1.1.7

AFAICT that is the cleanest fix.

@d0sdoc
Copy link
Author

d0sdoc commented Dec 6, 2019

Hi @d0sdoc do you still need any help? Were you able to fix the problem?

The only thing in sentry-go that pulls in github.com/ugorji/go/codec is the integration with github.com/gin-gonic/gin. Are you using gin in your program? What version?

go list -m github.com/gin-gonic/gin

I wrote a test program using Go modules and sentry-go v0.3.1 and gin v1.4.0 (the minimum required by sentry-go@v0.3.1) and could no reproduce the issue.

$ cat main.go
package main

import (
        "fmt"

        "github.com/getsentry/sentry-go"
        "github.com/gin-gonic/gin"
)

func main() {
        sentry.Init(sentry.ClientOptions{Debug: true})
        fmt.Println("hello", gin.BodyBytesKey)
}
$ go list -m github.com/gin-gonic/gin github.com/getsentry/sentry-go
github.com/gin-gonic/gin v1.4.0
github.com/getsentry/sentry-go v0.3.1
$ go version
go version go1.13.4 darwin/amd64

Please let me know if you have a repro or otherwise we can close this.

Thank you!

Yes, I'm using gin, version 1.4.0.

I've bump the ugorji version and it works, I've put github.com/ugorji/go v1.1.7 into go.mod.

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

Successfully merging a pull request may close this issue.

3 participants