I faced with the following problem:
- I forked a repo, and made some modifications to it under new branch
- I create PR to upstream repo and it is not yet merged
- I want to adjust my Go codebase to import the specific branch of my forked repo
The problem:
- if the original repo is
github.com/user/pkg/v3
then the forked repo appears asgithub.com/myusername/pkg
- moreover, I made a new branch, e.g.
mybranch
where I made my fixes - in the code where I used original repo I have an entry in my
go.mod
file asgithub.com/user/pkg/v3
which I want to replace with specific branch of my forked repo
How 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