Sometimes you are making changes to a dependency in another of your go projects and instead of adding a replace
command in the go.mod
file you want to update that entry in go.mod
to point to a specific commit in the repo.
To do so, all that you need to do is:
- Get the git commit that you want included in your build
- Change directories to the same directory that your project’s
go.mod
file resides in which you want to refer to the library with the specific commit - Run the following command which will automatically update your
go.mod
file with the correct “version” for your dependencygo get github.com/rchapin/rlog@<commit-hash>