cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules
marcoippolito opened this issue ยท 4 comments
Ubuntu 18.04.01 Server Edition
marco@pc01:~/go$ go version
go version go1.12.5 linux/amd64
marco@pc01:~/go/pkg/mod/github.com$ ls -lah
total 36K
drwxrwxr-x 9 marco marco 4.0K Jun 10 15:31 .
drwxrwxr-x 8 marco marco 4.0K May 31 08:40 ..
drwxrwxr-x 5 marco marco 4.0K Jun 10 15:08 gin-contrib
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:08 gin-gonic
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:08 golang
drwxrwxr-x 8 marco marco 4.0K May 31 08:40 gonum
drwxrwxr-x 5 marco marco 4.0K May 31 08:40 hashicorp
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:08 mattn
drwxrwxr-x 3 marco marco 4.0K May 31 08:40 pbnjay
When trying to execute the multiple-services example:
marco@pc01:~/go/marcoGolang/gin-examples/multiple-service$ go run main.go
go: extracting github.com/ugorji/go v1.1.4
go: extracting github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2
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 (/home/marco/go/pkg/mod/github.com/ugorji/go@v1.1.4/codec)
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 (/home/marco/go/pkg
/mod/github.com/ugorji/go/codec@v0.0.0-20181209151446-772ced7fd4c2)
marco@pc01:~/go/marcoGolang/gin-examples/multiple-service$
marco@pc01:~/go/pkg/mod/github.com$ ls -lah;
total 40K
drwxrwxr-x 10 marco marco 4.0K Jun 10 15:32 .
drwxrwxr-x 8 marco marco 4.0K May 31 08:40 ..
drwxrwxr-x 5 marco marco 4.0K Jun 10 15:08 gin-contrib
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:08 gin-gonic
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:08 golang
drwxrwxr-x 8 marco marco 4.0K May 31 08:40 gonum
drwxrwxr-x 5 marco marco 4.0K May 31 08:40 hashicorp
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:08 mattn
drwxrwxr-x 3 marco marco 4.0K May 31 08:40 pbnjay
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:32 ugorji
marco@pc01:~/go/pkg/mod/github.com/ugorji$ ls -lah
total 16K
drwxrwxr-x 4 marco marco 4.0K Jun 10 15:32 .
drwxrwxr-x 10 marco marco 4.0K Jun 10 15:32 ..
drwxrwxr-x 3 marco marco 4.0K Jun 10 15:32 go
dr-x------ 3 marco marco 4.0K Jun 10 15:32 go@v1.1.4
I realized that this happens for all examples.
How to solve the problem?
Hi,
There's 2 versions of the library in your path. I'm not sure how to help, but folks in the gin
group can help. Some of them can be found in #299 which you already referenced.
FInally, I am publishing a v1.2 around the end of next week. In case that helps somewhat.
Closing this now.
FYI: I just released a go-codec production release - version 1.1.7 (finally)
First, it resolves the go.mod impasse where we had different import paths (github.com/ugorji/go and github.com/ugorji/go/codec) causing the ambiguous import error.
This is now fixed by leveraging import cycles to ensure that either one works well and resolves to the same bits.
Please let me know if seeing any issues. If all is well over the next few days, I will close this github issue.
A temporary workaround for upstream deps using conflicting imports is to add this line to go.mod:
replace github.com/ugorji/go => github.com/ugorji/go/codec v1.1.7
@xichengliudui that is a different problem and unrelated to this issue; make sure whatever beyondcent.com/beyondmesh/src/api/executor
is imports the right package & version for crd
(that repo appears private and there isn't much we can help with as a result)