Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active November 14, 2021 16:20
Show Gist options
  • Save StevenACoffman/56a0539af1eed499022f872dfdad3d0d to your computer and use it in GitHub Desktop.
Save StevenACoffman/56a0539af1eed499022f872dfdad3d0d to your computer and use it in GitHub Desktop.
go mod update

If you use cgo, then a lot of go module tools get really slow per golang/go#29427

For example, this is really slow:

go list -m -u all

Maybe Instead:

$ go list -m -f '{{if not (or .Indirect .Main)}}{{.Path}}{{end}}' all
google.golang.org/api
google.golang.org/genproto
google.golang.org/grpc
google.golang.org/protobuf
mvdan.cc/gofumpt

$ go list -m -versions mvdan.cc/gofumpt@latest
mvdan.cc/gofumpt v0.1.0 v0.1.1

$ go list -m mvdan.cc/gofumpt@latest
mvdan.cc/gofumpt v0.1.1

Stupid pet tricks:

go list -m -f '{{if not (or .Indirect .Main)}}go get -d {{.Path}}@latest{{end}}' all

However, any packages pinned to unreleased versions will be downgraded.

Those are set to latest by:

go get -d github.com/Khan/genqlient@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment