See Modules · golang/go Wiki · GitHub below “replace directive”:
One sample use case is if you need to fix or investigate something in a dependency, you can have a local fork and add the something like the following in your top-level
go.mod
:
replace example.com/original/import/path => /your/forked/import/path