I have a project in which two dependencies uses different version of same library. For instance, my project has dependency A
and dependency B
. A
and B
, both uses a common library/dependency X
, but of different versions. A
has v1
version of X
and B
has v2
version of X
. So now when I add A
& B
as dependencies in my project, there are 2 versions of X
in my project's go.sum
.
I was expecting, the respective versions will be referred at run time by A
and B
. But it is not the case. Somehow when I run tests on my project, the A
is using v2
of X
, ideally it should use v1
(because in go.mod
of A
, explicitly specified/added v1
). So it breaks the execution,because there are lot differences in v1
and v2
of X
.
So in my project, how can I explicitly specify that to use v1
of X
by A
and use v2
by B
? Is there such provision in go modules?