Forking a Go project is a[1] bit[2] non-trivial[3]. Go requires absolute path (including repo URL) for imports. This, coupled with the fact that Github's PR system does not allow one to exclude certain changes from being included, it appears forking a Golang project and contributing back is slightly harder than what one assumes it to be.
If your goal is to have a temporary fork and contribute changes back to this repo, (Thank you!), follow these steps
- Fork on github
- mkdir $GOPATH/src/github.com/adobe # Note: this says
adobe
, not your github username git clone github.com/your-name/ferry
# to thisadobe
directory- Make improvements and send PRs back to
adobe/ferry
In this method
- Your changes work both in the local checkout of your branch as well as in the upstream repo as is without any changes.
- This makes it very easy for us to accept your changes. And you don't have to create a special branch to deal with it.
- Your repository requires the special checkout procedure described above to make it compile/build.
- If your changes are not accepted in upstream repository soon, it is harder to remember this convoluted setup.
-
Fork on github
-
Checkout to any directory, following Go recommendations. Typically this is $GOPATH/src/github.com/your-name/ferry
-
Use
go mod
'sreplace
directivereplace github.com/adobe/ferry => /path/to/my/fork/ferry OR replace github.com/adobe/ferry => github.com/your-name/ferry
-
See also this github issue comment
-
When you send a PR, remember to avoid sending the
go.mod
override.
If your goal is to have a permanent fork and never contribute back, you will need to
- Fork on github
- Change the imports in all go files based on compile errors
At this point, you will have tons of changes in many files and it would be cumbersome (although not impossible) to send changes back to our (upstream) repository.