Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
b071e8a
Keep Go hosted pins after go mod tidy drops zip line
mikolalysenko Oct 27, 2026
a1bfe6e
Check selection and workspace sums for tidy Go pins
mikolalysenko Oct 27, 2026
14057c8
Document tidy Go pin rules in the CLI contract
mikolalysenko Oct 27, 2026
14fa6d4
Don't attest Go pins a workspace never builds
mikolalysenko Oct 27, 2026
b23666d
Let a hosted Go re-run restore a pruned zip line
mikolalysenko Oct 27, 2026
46b40a1
Don't attest Go /go.mod-only pins in a workspace
mikolalysenko Oct 27, 2026
bc5f8c4
Ignore go.work.sum zip lines as selection proof
mikolalysenko Oct 28, 2026
2beda00
Check workspace Zip pins for a higher selected version
claude Oct 28, 2026
801e0c6
Read Go workspaces the way go does
mikolalysenko Oct 27, 2026
db13d81
Check go.work before writing hosted Go pins
mikolalysenko Oct 27, 2026
6a54b8b
Roll back hosted Go pins in go.work and members
mikolalysenko Oct 27, 2026
46f86dc
Test and document Go workspace support
mikolalysenko Oct 27, 2026
b796800
Stop attesting Go workspace pins go may not build
mikolalysenko Oct 28, 2026
cbb852b
Select Go workspace versions from the module graph
mikolalysenko Oct 28, 2026
052a4fa
Read Go workspace e2e warnings via common::envelope
mikolalysenko Oct 28, 2026
5132bb0
Accept the workspace inert wording in zip pin test
mikolalysenko Oct 28, 2026
22f8370
Write shared Go replaces into go.work
mikolalysenko Oct 27, 2026
61dddb3
Document go.work replaces for shared modules
mikolalysenko Oct 27, 2026
68e6445
Test one go.work replace for a shared module
mikolalysenko Oct 27, 2026
33cf080
Warn on stale vendor/ after a hosted go.work pin
mikolalysenko Oct 27, 2026
9a073d5
Fix Go workspace replace moves and rollbacks
mikolalysenko Oct 28, 2026
1874cc7
Refuse a go.work replace of a workspace module
mikolalysenko Oct 28, 2026
b7b1c61
Refuse to rewrite a symlinked go.work or go.mod
mikolalysenko Oct 28, 2026
78de435
Keep a missing final newline in go.mod and go.work
mikolalysenko Oct 28, 2026
d3f638b
Say when hosted rollback removes go.work.sum
mikolalysenko Oct 28, 2026
849332e
Fill the module cache in go.work vex fixtures
mikolalysenko Oct 28, 2026
83e3f1b
Pin go.work files in hosted redirect candidates
mikolalysenko Oct 28, 2026
6862138
Gate go.work replaces on the workspace module graph
claude Oct 28, 2026
10c1aa9
Merge remote-tracking branch 'origin/fix/golang-workspace-model' into…
claude Oct 28, 2026
f534ec7
Keep readable workspace members' requires in Go selection
claude Oct 28, 2026
fd0c850
Merge remote-tracking branch 'origin/fix/golang-tidy-gomod-only-pin' …
claude Oct 28, 2026
3afb712
Audit go.work Socket replaces' requirements against the workspace
claude Oct 28, 2026
91a3f56
Merge remote-tracking branch 'origin/fix/golang-workspace-model' into…
claude Oct 28, 2026
81d873f
Name go.work in the hosted-pin remedies
claude Oct 28, 2026
54fb3eb
Refuse Go pins an unread workspace graph cannot prove
claude Oct 28, 2026
d36fbbc
Merge fix/golang-workspace-model into feat/golang-workspace-writer
claude Oct 28, 2026
6dd327d
Load raised versions' go.mod in the workspace graph
claude Oct 28, 2026
883733a
Merge remote-tracking branch 'origin/fix/golang-workspace-model' into…
claude Oct 28, 2026
b7164aa
Attest Socket's go.work pin over a leftover member pin
claude Oct 28, 2026
5a2720f
Load the workspace graph at go's three pruning levels
claude Oct 28, 2026
503724f
Keep the root go.mod replace when the root is a go.work member
claude Oct 28, 2026
673e246
Treat a missing root go.mod mirror as drift
claude Oct 28, 2026
678f90e
Merge main into fix/golang-workspace-model
claude Oct 28, 2026
2913924
Restore a missing go.mod mirror without rebuilding the copy
claude Oct 28, 2026
5f86269
Merge remote-tracking branch 'origin/fix/golang-workspace-model' into…
claude Oct 28, 2026
6249c81
Merge fix/golang-workspace-model into feat/golang-workspace-writer
claude Oct 28, 2026
9ccc609
Merge main into feat/golang-workspace-writer
claude Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions crates/socket-patch-cli/src/commands/scan/hosted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1867,12 +1867,13 @@ async fn run_redirect_selected_untracked(
engine_warnings.extend(done.pnpm_warnings.iter().cloned());
engine_warnings.extend(done.npm_warnings.iter().cloned());
// A hosted Go `replace` breaks a committed vendor/ directory until
// `go mod vendor` re-records it in vendor/modules.txt (#343).
// `go mod vendor` (`go work vendor`) re-records it in
// vendor/modules.txt (#343).
if !common.dry_run
&& done
.rewritten
.iter()
.any(|f| f == "go.mod" || f.ends_with("/go.mod"))
.any(|f| f == "go.mod" || f == "go.work" || f.ends_with("/go.mod"))
{
for (code, detail) in socket_patch_core::vendor::go_consumer_sync::audit_warnings(
&common.cwd,
Expand Down Expand Up @@ -4304,6 +4305,8 @@ mod tests {
"gems.locked",
"go.mod",
"go.sum",
"go.work",
"go.work.sum",
"pom.xml",
".mvn/maven.config",
".mvn/checksums/checksums.sha256",
Expand Down
20 changes: 18 additions & 2 deletions crates/socket-patch-cli/src/commands/vex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,11 +958,20 @@ async fn generate_vex(
let socket_patch_core::vendor::go_consumer_sync::GoSyncIssue::Workspace {
module,
version,
..
conflict,
} = &issue
else {
continue;
};
// Socket's own go.work replace overriding a leftover member pin
// is what the build links; it passes its own selection gate
// below, like any go.work replace.
if matches!(
conflict,
socket_patch_core::vendor::go_workspace::WorkspaceConflict::WorkHosted { .. }
) {
continue;
}
// PurlKey, not string equality: go.mod spells `+incompatible`
// with a literal `+`, the manifest key with `%2B` (#484). Report
// each omission under the record's own spelling.
Expand Down Expand Up @@ -993,7 +1002,14 @@ async fn generate_vex(
use socket_patch_core::utils::purl_key::PurlKey;
use socket_patch_core::vendor::go_build_list::{project_selection, Selection};
let mut entries = Vec::new();
for root in socket_patch_core::vendor::go_workspace::module_roots(&common.cwd).await {
let mut roots = socket_patch_core::vendor::go_workspace::module_roots(&common.cwd).await;
Comment thread
mikolalysenko marked this conversation as resolved.
Resolved
// A go.work root's own replaces live in its go.work.
if !roots.contains(&common.cwd)
&& socket_patch_core::vendor::go_workspace::root_work_file(&common.cwd).is_some()
{
roots.push(common.cwd.clone());
}
for root in roots {
for entry in socket_patch_core::vendor::go_mod_edit::read_replace_entries(&root).await {
entries.push((root.clone(), entry));
}
Expand Down
9 changes: 8 additions & 1 deletion crates/socket-patch-cli/tests/e2e_golang_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,9 @@ fn go_work_replace_overrides_the_socket_replace() {
}

/// #458: a go.work that doesn't `use` the project makes every workspace
/// build ignore the project's go.mod, replace included.
/// build ignore the project's go.mod, replace included. Run beside that
/// go.work, apply still refuses: a go.work replace would patch its member,
/// never the project.
#[test]
fn go_work_without_the_project_ignores_its_replace() {
if !golang_e2e_matrix::toolchain_ready("e2e_golang_build(go-work-not-member)") {
Expand All @@ -1005,6 +1007,11 @@ fn go_work_without_the_project_ignores_its_replace() {
assert_ne!(code, 0, "apply must refuse an ignored replace:\n{so}\n{se}");
assert!(so.contains("does not `use` this module"), "{so}");
assert!(replace_lines(&consumer.join("go.mod")).is_empty());
assert_eq!(
std::fs::read_to_string(consumer.join("go.work")).unwrap(),
go_work
);
assert!(go_out(&svc, &env).contains("OUT: PRISTINE"));

// Applied before the go.work existed.
std::fs::remove_file(consumer.join("go.work")).unwrap();
Expand Down
Loading
Loading