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

cannot load github.com/ugorji/go/codec: ambiguous import: found .... in multiple modules #86

Closed
maerics opened this issue May 10, 2019 · 2 comments · Fixed by #87
Closed

Comments

@maerics
Copy link
Contributor

maerics commented May 10, 2019

I wanted to try the cookie-based session example from the readme but it fails with the following error:

cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:

To reproduce:

$ ls -l
total 0
$ go mod init foo
go: creating new go.mod: module foo
$ # copy cookie-based example code into the clipboard
$ pbpaste > ./main.go
$ go fmt ./main.go && go run ./main.go 
go: finding github.com/gin-contrib/sessions latest
go: finding github.com/gin-contrib/sessions/cookie latest
go: finding github.com/gin-gonic/gin v1.4.0
...
go: extracting github.com/gorilla/securecookie v1.1.1
build command-line-arguments: 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 (/Users/x/go/pkg/mod/github.com/ugorji/go@v1.1.4/codec)
	github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 (/Users/x/go/pkg/mod/github.com/ugorji/go/codec@v0.0.0-20181209151446-772ced7fd4c2)
$ echo $?
1

I can't tell if this is an issue with ugorji/go or cmd/go itself but thought I'd post here in case anyone knows of a fix. Will update if I find one.

@maerics
Copy link
Contributor Author

maerics commented May 11, 2019

Here's a workaround found in ugorji/go#279:

go get github.com/ugorji/go@v1.1.2-0.20180831062425-e253f1f20942

@kuhufu
Copy link

kuhufu commented May 11, 2019

I also encountered this problem.
gin latest version
in file go.mod
github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43
change to
github.com/ugorji/go v1.1.4

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

Successfully merging a pull request may close this issue.

2 participants