Closed bcmills closed 5 years ago
As a workaround in the interim, anyone running into the ambiguous import error can apply the fix themselves by running
go get github.com/ugorji/go@v1.1.2-0.20180831062425-e253f1f20942
why v1.1.2-XXX ? I am a big confused, and I don't want to make assumptions.
As a workaround in the interim, anyone running into the ambiguous import error can apply the fix themselves by running
go get github.com/ugorji/go@v1.1.2-0.20180831062425-e253f1f20942
I don't understand why this works? There's no tag v1.1.2. Is this a git thing, and if so, can you explain?
I truly don't understand the quirks of modules yet. I just want to support a multi-module repo, which is what I had been wanting from the beginning, and this feels like the best time to get it setup. I want folks to treat github.com/ugorji/go/codec as a module in itself (not github.com/ugorji/go)
This should be fixed now, as at 8fd0f8d . Please let me know if this is fixed for you.
Thanks for the fix!
why v1.1.2-XXX ?
That's the pseudo-version at which the packages were removed from the root module, so that requirement ensures that only the github.com/ugorji/go/codec
module provides those packages.
Hi folks,
Please see https://github.com/ugorji/go/issues/299 and add your thoughts/ideas/etc. Thanks.
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.
The
go.mod
file introduced for #259 effectively splits theugorji/go
repository into two separate modules:github.com/ugorji/go
andgithub.com/ugorji/go/codec
.A repository without a
go.mod
file is effectively a single module, so prior to the introduction of that file, the latest tagged version (v1.1.1
) had all of the packages in modulegithub.com/ugorji/go
, and some existing users already depended on that module (https://github.com/etcd-io/etcd/blob/329be66e8b3f9e2e6af83c123ff89297e49ebd15/go.mod#L45).Now, if some program combines those existing users with a user of the new module, they receive two distinct copies of each package (via the two distinct modules), and the build fails with an
ambiguous import
error:To resolve this problem, I recommend that you add the following line to
github.com/ugorji/go/codec/go.mod
:Until golang/go#27899 is resolved, you may need to re-add the line whenever you run
go mod tidy
, or add another.go
source file to ensure that it is not removed (as described in https://github.com/golang/go/issues/27899#issuecomment-432663636).