diff --git a/golang/src/com/google/idea/blaze/golang/run/BlazeGoRunConfigurationRunner.java b/golang/src/com/google/idea/blaze/golang/run/BlazeGoRunConfigurationRunner.java index 2f1ce2cc197..193341030ba 100644 --- a/golang/src/com/google/idea/blaze/golang/run/BlazeGoRunConfigurationRunner.java +++ b/golang/src/com/google/idea/blaze/golang/run/BlazeGoRunConfigurationRunner.java @@ -440,10 +440,13 @@ private static ExecutableInfo parseScriptPathFile( if (args.size() < 3) { throw new ExecutionException("Failed to parse args in script_path: " + scriptPath); } - envVars.put("TEST_SRCDIR", testScrDir.group(1)); + // Make paths used for runfiles discovery absolute as the working directory is changed below. + envVars.put("TEST_SRCDIR", workspaceRoot.absolutePathFor(testScrDir.group(1)).toString()); Matcher runfilesVars = RUNFILES_VAR.matcher(text); while (runfilesVars.find()) { - envVars.put(String.format("RUNFILES_%s", runfilesVars.group(1)), runfilesVars.group(2)); + envVars.put( + String.format("RUNFILES_%s", runfilesVars.group(1)), + workspaceRoot.absolutePathFor(runfilesVars.group(2)).toString()); } String workspaceName = execRoot.getName(); binary =