I 'd like to pin the version of one package, so whenever I run
go get -u ./...
..this package would stay unchanged (but the rest refreshed normally).
If you want to pin specific version for a particular Go package, then it can be done via replace directive. For example, the following go.mod config pins golang.org/x/exp to v0.0.0-20230713183714-613f0c0eb8a1, so go get -u -d ./... doesn't updated this package to newer version:
module github.com/myname/mymodule
replace golang.org/x/exp => golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
require (
...
// This version is updated with go get -u -d ./..., but it is always
// overridden by the version specified in the replace directive above
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
...
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With