Involved Source Filesdiff.godownload.goflags.gohtmlgen.go
Goupdate is a tool for updating Go module dependencies. It is supports Go
workspaces and is an alternative to running go get -t -u that attempts to
be less conservative and produces apidiff reports.
Warning
Note that goupdate loops until there are no updates available in the build
graph. This may be inefficient but should be good enough in practice.
Module dependencies are updated in-place and may leave workspace in broken
state on failure. Use with extreme caution if there are unsaved changes. It
is recommended to run goupdate as part of the scheduled CI pipeline instead.
CI
Integrating goupdate with GitHub Actions or other CI solutions that support
scheduled pipelines should be straightforward and only requires Go toolchain
to be installed. Goupdate can generate HTML reports (that can be embedded in
Markdown) with overview of updated modules and API changes. It can also run
tests and includes results in the generated reports. Test failures are
intended to be reviewed by humans and so do not cause goupdate to exit with
non-zero status code.
Motivation
Goupdate was written after fighting with dependabot storming repositories
with pull requests per dependency update per module in workspace. In addition
to that, dependabot does not support updating modules with pseudo-versions
like golang.org/x/crypto which does not publish semver-tagged releases, see
https://github.com/dependabot/dependabot-core/issues/3017. It also does not
support Go workspaces which we use extensively since their introduction in
Go 1.18.
modules.gopackages.goreport.gotests.gotextgen.goupgrade.goworkspaces.go
Package-Level Type Names (total 13, none are exported)
/* sort exporteds by: | */
// absolute path to cached source root directory
// error loading module
// absolute path to cached .mod file
// checksum for go.mod (as in go.sum)
// absolute path to cached .info file
// module path
// checksum for path, version (as in go.sum)
// module version
// absolute path to cached .zip file
func queryUpgrades(workspaceDir string, modulePaths []string) ([]downloadedModule, error)
func queryUpgradesCached(workspaceDir string, deps []string, cache map[string]downloadedModule) ([]downloadedModule, error)
func queryUpgradesCached(workspaceDir string, deps []string, cache map[string]downloadedModule) ([]downloadedModule, error)
Added is a list of added packages.
Changed is a list of changed packages.
New is the new module.
OldBroken is a list of broken packages in the new version.
Old is the old module.
OldBroken is a list of broken packages in the old version.
Path is the module path of the updated module.
Added is a list of removed packages.
Unchanged returns true if there are no changes except for the version bump.
Added is a list of added module dependencies.
Removed is a list of removed module dependencies.
Updated is a list of updated module dependencies.
func diffState(prev, final *state) stateDiff
Dir, if non-empty, is a directory of the Go workspace.
Paths is a list of modules in the current workspace. If Dir is empty,
it contains a single directory for the main module.
Root returns workspace root directory.
func loadWorkspace() (*workspace, error)
func goworksync(w *workspace) error
func runTests(f *flags, w *workspace) (*testReport, error)
func syncWorkspace(w *workspace) error
func upgradeModules(w *workspace, s *state) (*state, error)
Package-Level Functions (total 32, none are exported)