Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
print GOROOT/GOPATH for any tool invoked
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed Jul 3, 2017
1 parent ee75b7d commit b02983b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,12 @@ protected BuildOperationCreator createBuildOperationCreator(
protected void addCompositeBuildOperationMessage() throws CommonException {
super.addCompositeBuildOperationMessage();

GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);

addOperation(newMessageOperation(" with GOROOT: " + goEnv.getGoRoot().asString() + "\n"));
addOperation(newMessageOperation(" with GOPATH: " + goEnv.getGoPathString() + "\n"));
// experimental: this code was removed, and instead this info is printed by the tool ruun
// which will print it for any Go tool invoked, not just for build
// GoEnvironment goEnv = GoProjectEnvironment.getGoEnvironment(project);
//
// addOperation(newMessageOperation(" with GOROOT: " + goEnv.getGoRoot().asString() + "\n"));
// addOperation(newMessageOperation(" with GOPATH: " + goEnv.getGoPathString() + "\n"));
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
*******************************************************************************/
package com.googlecode.goclipse.ui;

import com.googlecode.goclipse.tooling.env.GoEnvironmentConstants;

import melnorme.lang.ide.ui.LangImages;
import melnorme.lang.ide.ui.tools.console.LangOperationsConsoleUIHandler;
import melnorme.lang.ide.ui.tools.console.ToolsConsole;
import melnorme.lang.ide.ui.tools.console.ToolsConsole.IOConsoleOutputStreamExt;
import melnorme.lang.utils.EnvUtils;

public class GoOperationsConsoleUIHandler extends LangOperationsConsoleUIHandler {

Expand All @@ -38,6 +41,20 @@ protected OperationConsoleMonitor createConsoleHandler(ProcessStartKind kind, To
return monitor;
}

@Override
protected String getPrefaceText(String prefixText, String suffixText, ProcessBuilder pb) {
String prefaceText = super.getPrefaceText(prefixText, suffixText, pb);
String goRoot= EnvUtils.getVarFromEnvMap(pb.environment(), GoEnvironmentConstants.GOROOT);
if (goRoot != null) {
prefaceText += " with GOROOT: " + goRoot + "\n";
}
String goPath = EnvUtils.getVarFromEnvMap(pb.environment(), GoEnvironmentConstants.GOPATH);
if (goPath != null) {
prefaceText += " with GOPATH: " + goPath + "\n";
}
return prefaceText;
}

@Override
protected String getProcessTerminatedMessage(int exitCode) {
return " " + super.getProcessTerminatedMessage(exitCode);
Expand Down

0 comments on commit b02983b

Please sign in to comment.