Golang: replace module by own

Автор | 04.05.2020

When you need to do fast fix for some module without to push it use option replace in go.mod

For example, i want to check – my application will be work with changes in branch ?

cd /tmp/<my code>
git clone github.com/<repo>
git checkout branch-with-fix
nano go.mod

and add replace for that repo

require (
        github.com/<repo> v0.1.1
        github.com/pkg/errors v0.9.1 // indirect
        go.opencensus.io v0.22.3 // indirect

replace github.com/<repo> v0.1.1 => /tmp/<mycode>/<repo>

Залишити відповідь