@@ -1469,6 +1469,11 @@ func TestCheckSystemGoVersion(t *testing.T) {
14691469 // On Windows, create a real compiled executable to avoid exec.Command issues with .bat files
14701470 goBinary += ".exe"
14711471
1472+ // Find the real Go compiler before modifying PATH
1473+ // This ensures we can compile even if PATH gets modified
1474+ realGoPath , err := exec .LookPath ("go" )
1475+ require .NoError (t , err , "Failed to find Go compiler in PATH" )
1476+
14721477 // Create a temporary Go source file
14731478 sourceFile := filepath .Join (systemGoDir , "go.go" )
14741479 sourceCode := `package main
@@ -1480,8 +1485,8 @@ func main() {
14801485 err = os .WriteFile (sourceFile , []byte (sourceCode ), 0o644 )
14811486 require .NoError (t , err )
14821487
1483- // Compile it to create the executable
1484- cmd := exec .Command ("go" , "build" , "-o" , goBinary , sourceFile )
1488+ // Compile it to create the executable using absolute path to real Go
1489+ cmd := exec .Command (realGoPath , "build" , "-o" , goBinary , sourceFile )
14851490 output , err := cmd .CombinedOutput ()
14861491 require .NoError (t , err , "Failed to compile mock go.exe: %s" , output )
14871492 } else {
0 commit comments