Work with go modules

Working with Go modules is a big topic. Some things are hard to find and not obvious.

Replace a module with a fork (and branch)

Sometimes you need to replace an upstream module with a fork, to test out a new feature.

In go.mod, do enter following:

replace host.com/someone/pkg => host.com/you/pkg branch

Note the space between pkg and branch.

Source