Skip to content

Commit f99356f

Browse files
committed
Fix: Refuse to confirm golang redirects when workspace selection is Unknown
When the workspace graph is Unknown, we cannot prove what version the workspace actually builds. An existing socket replace directive might be from an apply pin, vendor pin, or written under GOWORK=off, none of which prove the workspace uses that version. This fix ensures that Unknown workspace selection always refuses to write and confirm redirects, regardless of whether a same-version prior replace exists, preventing false confirmation of potentially inert pins.
1 parent fd0c850 commit f99356f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • crates/socket-patch-core/src/patch/redirect

‎crates/socket-patch-core/src/patch/redirect/mod.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9575,7 +9575,8 @@ fn rewrite_golang_target(
95759575
}
95769576
return false;
95779577
} else if selection != go_build_list::Selection::Selected
9578-
&& prior.is_none_or(|e| e.version.as_deref() != Some(dep.version.as_str()))
9578+
&& (selection == go_build_list::Selection::Unknown
9579+
|| prior.is_none_or(|e| e.version.as_deref() != Some(dep.version.as_str())))
95799580
{
95809581
// Not selected by go.mod's require, no go.sum zip line at this
95819582
// version, and not already redirected by us: the module is

0 commit comments

Comments
 (0)