Skip to content

Commit 9af28a9

Browse files
author
Andreas Sinz
committed
Always build the whole pkg with go build instead of a single file
1 parent 9d8c073 commit 9af28a9

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/ro/redeul/google/go/runner/GoRunProfileState.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,14 @@ protected ProcessHandler startProcess() throws ExecutionException {
9292

9393
try {
9494
String[] goEnv = GoSdkUtil.convertEnvMapToArray(sysEnv);
95-
String[] command = GoSdkUtil.computeGoBuildCommand(goExecName, m_configuration.runBuilderArguments, execName, m_configuration.scriptName);
95+
96+
String pkg = GoSdkUtil.getPackageOfFile(projectDir, m_configuration.scriptName);
97+
98+
if(pkg == null) {
99+
throw new CantRunException("Script is not inside the project root");
100+
}
101+
102+
String[] command = GoSdkUtil.computeGoBuildCommand(goExecName, m_configuration.runBuilderArguments, execName, pkg);
96103

97104
Runtime rt = Runtime.getRuntime();
98105
Process proc = rt.exec(command, goEnv, new File(projectDir));

src/uk/co/cwspencer/ideagdb/run/GoDebugProfileState.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@ public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner)
8484

8585
try {
8686
String[] goEnv = GoSdkUtil.convertEnvMapToArray(sysEnv);
87-
String[] command = GoSdkUtil.computeGoBuildCommand(goExecName, m_configuration.debugBuilderArguments, execName, m_configuration.scriptName);
87+
88+
String pkg = GoSdkUtil.getPackageOfFile(projectDir, m_configuration.scriptName);
89+
90+
if(pkg == null) {
91+
throw new CantRunException("Script is not inside the project root");
92+
}
93+
String[] command = GoSdkUtil.computeGoBuildCommand(goExecName, m_configuration.debugBuilderArguments, execName, pkg);
8894

8995
Runtime rt = Runtime.getRuntime();
9096
Process proc = rt.exec(command, goEnv, new File(projectDir));

0 commit comments

Comments
 (0)