From 15cf91eb3274310a4045bfa928b5ebee0bb27f8b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 07:56:40 +0000 Subject: [PATCH] Fix Go GOWORK test on macOS symlinked tmp The nightly macOS test leg has failed since #1812 added apply_never_writes_go_work_when_gowork_names_a_sibling_file. The test sets GOWORK to a file under the tempdir and then runs go in a member. go takes its working directory with symlinks resolved, so on macOS (/var -> /private/var) the member sits outside the workspace GOWORK names and go refuses it: "directory a is contained in a module that is not one of the workspace modules listed in go.work". Stage the test under the canonical tempdir on Unix. Windows keeps the plain path, where canonicalize would give a \\?\ path go can't use. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_011f9aeT7Z8SgtvNfjPY7zCb --- .../tests/e2e_golang_workspace_build.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/socket-patch-cli/tests/e2e_golang_workspace_build.rs b/crates/socket-patch-cli/tests/e2e_golang_workspace_build.rs index 10a9cc7d3..767809d96 100644 --- a/crates/socket-patch-cli/tests/e2e_golang_workspace_build.rs +++ b/crates/socket-patch-cli/tests/e2e_golang_workspace_build.rs @@ -1405,8 +1405,17 @@ fn apply_never_writes_go_work_when_gowork_names_a_sibling_file() { } let tmp = tempfile::tempdir().unwrap(); let _guard = ChmodGuard(tmp.path().to_path_buf()); - let w = stage_members(tmp.path(), UVER, UVER); - let m = Machine::new(tmp.path(), "sibling"); + // go takes its working directory with symlinks resolved, so a GOWORK + // under an unresolved temp path (macOS's /var -> /private/var) holds + // no member go runs in. (Windows keeps the path: canonicalize would + // give a \\?\ path go can't use.) + let base = if cfg!(windows) { + tmp.path().to_path_buf() + } else { + tmp.path().canonicalize().unwrap() + }; + let w = stage_members(&base, UVER, UVER); + let m = Machine::new(&base, "sibling"); download(&w.root, &m, &w.proxy); write_local_patch(&w.root, VENDOR_UUID); let ci = w.root.join("ci.work"); @@ -1477,7 +1486,7 @@ fn apply_never_writes_go_work_when_gowork_names_a_sibling_file() { assert_eq!(read(&w.root.join("go.work")), work, "go.work untouched"); assert_eq!(read(&ci), work, "ci.work untouched"); for dir in ["a", "b"] { - let (stdout, stderr) = run_member(tmp.path(), &w.root, dir, &w.proxy, &gowork); + let (stdout, stderr) = run_member(&base, &w.root, dir, &w.proxy, &gowork); assert!( stdout.contains(&format!("{}: PATCHED", dir.to_uppercase())), "{dir}: {stdout}\n{stderr}"