Let say you have a project A that depends on an open-source library B:
A -> B
Now for your own need, you need to enhance library B in order to fit your need. So you fork it as B2:
B -> B2
While you're waiting for the maintainer of B to approve your PR, how do you configure your project A to make use of B2? Turns out it's pretty easy! Here's the step:
- Fork B as B2
- Clone B2 locally
- Open A's `go.mod` file, add the following line if you're doing local developmentreplace github.com/Khan/genqlient => /Users/aharijanto/src/opensource/genqlient
Or if you're doing remote developmentreplace github.com/Khan/genqlient => github.com/dharijanto/genqclient@branch-name
Once your change made it to the original repository, simply remove the replace directive! Golang is just so sweet, isn't it? :)
Source:
https://stackoverflow.com/questions/72312460/how-to-replace-a-go-module-with-a-major-version-to-a-fork-master