From 29d3feea1e1e997084ef2ebfb792ad0b7f0fe04f Mon Sep 17 00:00:00 2001 From: Pascal Watteel Date: Mon, 9 Nov 2026 17:26:52 +0400 Subject: [PATCH] test(lint): build fake module roots from t.TempDir so they are absolute on Windows --- internal/lint/gomod_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/lint/gomod_test.go b/internal/lint/gomod_test.go index f0d76d9..1f43265 100644 --- a/internal/lint/gomod_test.go +++ b/internal/lint/gomod_test.go @@ -369,7 +369,7 @@ func TestGroupSplitsByModuleUnlessAWorkspace(t *testing.T) { // proved by: compute patterns relative to the root — ./sub/x leaks into the // nested module's run; drop the dedupe — ./x appears twice. func TestGoPatternsAreRelativeToTheModule(t *testing.T) { - mod := filepath.Join(string(filepath.Separator), "r", "sub") + mod := filepath.Join(t.TempDir(), "r", "sub") got := goPatterns(mod, []string{ filepath.Join(mod, "main.go"), filepath.Join(mod, "x", "a.go"), @@ -385,7 +385,7 @@ func TestGoPatternsAreRelativeToTheModule(t *testing.T) { // proved by: return the path unchanged — a finding printed as x/x.go in the // sub module no longer matches the wanted sub/x/x.go and is silently dropped. func TestRepoRelPathMapsModuleRelativeFindingsToTheRoot(t *testing.T) { - root := filepath.Join(string(filepath.Separator), "r") + root := t.TempDir() // absolute on every OS, drive letter included sub := filepath.Join(root, "sub") for _, c := range []struct{ modDir, in, want string }{ {sub, "x/x.go", "sub/x/x.go"},