fix(autodiscovery/golang): correctly handle pseudo version#8698
Merged
olblak merged 7 commits intoMay 14, 2026
Conversation
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve the Golang autodiscovery pipeline generation so that modules pinned to Go pseudo-versions don’t break version filtering and can still be updated correctly.
Changes:
- Added pseudo-version detection via
isPseudoVersion(regex-based). - Updated Golang dependency autodiscovery to override the version filter when a pseudo-version is detected.
- Extended autodiscovery tests to cover pseudo-version scenarios.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| pkg/plugins/autodiscovery/golang/utils.go | Adds pseudo-version detection helper and regex. |
| pkg/plugins/autodiscovery/golang/dependency.go | Overrides versionfilter kind/pattern when a dependency (or replace) uses a pseudo-version. |
| pkg/plugins/autodiscovery/golang/utils_test.go | Updates search expectations and adds unit tests for pseudo-version detection. |
| pkg/plugins/autodiscovery/golang/main_test.go | Adds an autodiscovery fixture test for pseudo-version manifest generation. |
Comments suppressed due to low confidence (1)
pkg/plugins/autodiscovery/golang/dependency.go:178
- Same as above for
replacemodules:kindis switched tolatestbutpatternis set to"". Withkind: latest, the filter logic expectspattern: latest; otherwise it can fail to resolve a version when the proxy returns a list. Set the pattern tolatest(or use a semver "latest" pattern) to avoid producing non-functional manifests for replaced modules.
goModuleVersionPattern := g.versionFilter.Pattern
goModuleVersionKind := g.versionFilter.Kind
switch isPseudoVersion(replace.NewVersion) {
case false:
goModuleVersionPattern, err = g.versionFilter.GreaterThanPattern(replace.NewVersion)
if err != nil {
logrus.Debugf("skipping golang module %q due to: %s", replace.NewPath, err)
continue
}
case true:
// If the new version is a pseudo-version,
// we cannot apply a version filter pattern as
// golang registry will only return one version for this module.
logrus.Debugf("Module %q uses a pseudo-version %q, so ignoring version filter for this module as the registry will only return one version", replace.NewPath, replace.NewVersion)
goModuleVersionKind = "latest"
goModuleVersionPattern = ""
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
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.
Fix pseudo version in golang autodiscovery.
If a go module uses a pseudo version then Updatecli override the version filter to handle it.
A pseudo version looks like "v0.0.0-20260209031235-2402fdf4a9ed"
Test
To test this pull request, you can run the following commands:
Additional Information
Checklist
Tradeoff
Potential improvement