Fix indirect resolver to respect replace directives#21
Open
kbsteere wants to merge 3 commits intochainguard-dev:mainfrom
Open
Fix indirect resolver to respect replace directives#21kbsteere wants to merge 3 commits intochainguard-dev:mainfrom
kbsteere wants to merge 3 commits intochainguard-dev:mainfrom
Conversation
a1c8cd0 to
ee1e9c0
Compare
Signed-off-by: Kyle Steere <kyle.steere@chainguard.dev>
ee1e9c0 to
dbad3d6
Compare
tcnghia
reviewed
Mar 3, 2026
…lace conflict detection - Remove duplicate hasReplaceDirective from indirect_resolver.go; the canonical version already exists in golang.go (landed via chainguard-dev#27). Having both in the same package caused a compile error on merge. - Add nil guard to golang.go's hasReplaceDirective to match the defensive check that existed in the removed duplicate. - Fix hasReplaceConflicts to treat local path replaces (empty version string) as a conflict; semver.Compare returns 0 for non-semver strings so they were previously silently ignored. - Simplify hasReplaceConflicts: remove conflictCount accumulator in favour of early return on first conflict; convert log.Info per-conflict calls to clog.DebugContext per go-standards. - Add capacity hint to replaceMap make() call. - Fix nil dereference in analyzer.go: guard Dependencies map lookup and Metadata field before writing foundInModules. - Replace context.Background() with t.Context() in replace directive tests. - Update libp2p test fixture version v0.47.0 -> v0.48.0 to match current proxy.
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.
The indirect dependency resolver was recommending parent package bumps that would break builds when the user's go.mod contains replace directives. This fix adds replace directive awareness by skipping dependencies with replace directives, checking for version conflicts when evaluating parent versions, and handling v0.0.0 placeholders used by k8s.io/kubernetes for internal replace directives. Now omnibump correctly recommends direct bumps instead of problematic parent bumps when replace directives are present.