Reputation: 1654
I faced with the following problem:
The problem:
github.com/user/pkg/v3
then the forked repo appears as github.com/myusername/pkg
mybranch
where I made my fixesgo.mod
file as github.com/user/pkg/v3
which I want to replace with specific branch of my forked repoHow should I correctly solve this issue?
What I see when I tried to change go.mod
of my forked repo to be github.com/myusername/pkg/v3
and then call go get github.com/myusername/pkg@mybranch
is the following
go: github.com/myusername/pkg/v3@vxx-xx-xx: parsing go.mod:
module declares its path as: github.com/user/pkg/v3
but was required as: github.com/myusername/pkg/v3
Upvotes: 0
Views: 829
Reputation: 1654
I found required solution. The trick was to perform the following series of steps:
go.mod
file of my package to use replace
directive and my new tag like thisreplace github.com/user/pkg/v3 => github.com/myusername/pkg/v3 v3.1.2
Therefore, in order to use forked repo with new branch we must tag this branch in forked repo with version higher of the tag in upstream repo.
Upvotes: 2