So I’ve created a fork of a Go module (cobra), written some new code and tests. Then in my client app, I attempted to use my new fork and because of my naive approach, there were all sorts of errors and issues. I realised that forking a Go project is a little more complicated than I thought (I’ve only been using Go for a few weeks so I’m still learning).
So I need to know how to do 2 things
-
First what do you have to do in the fork, to make sure that clients can use it correctly.
-
What changes to make in client projects to switch over to my forked version of cobra.
Googling around doesn’t give me the whole story, that covers both of the points above.
I have been able to run tests in my fork with my changes, but I havent pushed those changes yet. I realise I have already made a mistake here, because I have not changed the local module path. IE, the path in my go.mod file still points to the orginal (github.com/spf13/cobra) instead of my fork github.com/snivilised/cobra, but this doesn’t break running the tests locally. I also havent changed any import paths in the forked source code.
Experimenting by making adhoc changes to paths, doesnt seem to work. I guess I need to do some kind of
“go mod edit -replace”, but I thought this was only a temporary measure that shouldnot be checked in, so I’m totally confused and need somebody who knows about this to let me know what the correct workflow is.
Thanks.