}
final String configName = (new File(packageDir)).getName();
// Now add a new run configuration:
RunManager runManager = RunManager.getInstance(module.getProject());
GoApplicationConfigurationType goAppConfigType = new GoApplicationConfigurationType();
GoApplicationConfigurationType.GoFactory goConfigFactory = new GoApplicationConfigurationType.GoFactory(new GoApplicationConfigurationType());
GoApplicationConfiguration configuration = new GoApplicationConfiguration("name", module.getProject(), goAppConfigType);
configuration.runPackage = true;
configuration.packageDir = packageDir;
configuration.workingDir = module.getProject().getBasePath();
configuration.goOutputDir = module.getProject().getBasePath() + File.separatorChar + "bin";
configuration.goBuildBeforeRun = true;
configuration.runBuilderArguments = "";
configuration.runExecutableName = configName;
configuration.scriptName = "";
configuration.scriptArguments = "";
configuration.autoStartGdb = true;
configuration.GDB_PATH = "gdb";
configuration.debugBuilderArguments = "-gcflags \"-N -l\"";
configuration.setModule(module);
configuration.setName(configName);
RunnerAndConfigurationSettings runAndConfig = runManager.createConfiguration(configuration, goConfigFactory);
runManager.addConfiguration(runAndConfig, false);
runManager.setSelectedConfiguration(runAndConfig);
toolWindow.showAndCreate(module.getProject());
} catch (CantRunException e) {