add --additional-autoupdateable-dependencies option#468
Open
add --additional-autoupdateable-dependencies option#468
Conversation
In order to further reduce the amount of work from having to approve the same dependency update multiple times, I would like to have the go-makefile-maker pipeline consider go.mod files of our library repos (e.g. go-bits and gophercloud-sapcc). This would allow external dependency updates that were vetted there to automatically bubble through even into repos that do not depend on those libraries directly.
Contributor
Merging this branch will not change overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
There was a problem hiding this comment.
Pull request overview
Adds a new CLI option intended to widen Go dependency autoupdate eligibility by considering dependency versions from other repositories’ go.mod files (so “already vetted elsewhere” updates can propagate automatically).
Changes:
- Adds
--additional-autoupdateable-dependenciesflag and threads runtime autoupdate config into the updater. - Extends the Go dependency autoupdate logic to parse additional
go.modfiles and selectively upgrade shared modules to newer versions found there. - Updates README documentation for the expanded autoupdate behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
main.go |
Adds new CLI flag and passes runtime autoupdate configuration into the Go updater. |
internal/golang/update-deps.go |
Implements “approved-by-other-go.mod” version comparisons and module upgrades. |
README.md |
Documents the two autoupdate mechanisms (regex-based and additional go.mod-based). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| @@ -75,7 +77,7 @@ func main() { | |||
|
|
|||
| if flags.AutoupdateDeps && cfg.Golang.AutoupdateableDepsRx != "" { | |||
| ShowHelp bool | ||
| } | ||
| pflag.BoolVar(&flags.AutoupdateDeps, "autoupdate-deps", false, "autoupdate dependencies matching the golang.autoupdateableDeps config option (if any)") | ||
| pflag.BoolVar(&flags.AutoupdateDeps, "autoupdate-deps", false, "try to autoupdate dependencies matched by the golang.autoupdateableDeps config option or the --approved-dependency-sets switch (if any)") |
Comment on lines
28
to
29
| // AutoupdateDependencies will run `go get -u $MODULEPATH@latest` for each | ||
| // direct dependency matching `cfg.AutoupdateableDepsRx`. |
| return None[string]() | ||
| } | ||
|
|
||
| // update dependencies matched by any of the ApprovedDependencySets |
| continue | ||
| } | ||
| if semver.Compare(ourVersion, req.Mod.Version) < 0 { | ||
| must.Succeed(runGo("get", "-u", req.Mod.Path+"@"+req.Mod.Version)) |
Comment on lines
+256
to
+259
| Autoupdates can be configured in two ways: | ||
| - If `golang.autoupdateableDeps` is filled with a [regular expression](https://pkg.go.dev/regexp/syntax), all module dependencies matching that regex are upgraded using `go get -u $MODULE@latest`. | ||
| This is intended for internal dependencies that have already gone through approval processes as the code was developed. | ||
| - If `--additional-autoupdateable-dependencies /path/to/other/go.mod` is given, any dependencies shared by both our `go.mod` and the provided other `go.mod` file will be upgraded to the version in the other file (using `go get -u $MODULE@$VERSION`) if that version is newer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order to further reduce the amount of work from having to approve the same dependency update multiple times, I would like to have the go-makefile-maker pipeline consider go.mod files of our library repos (e.g. go-bits and gophercloud-sapcc). This would allow external dependency updates that were vetted there to automatically bubble through even into repos that do not depend on those libraries directly.