if (sdkData == null) {
// skip since the folder isn't a proper go sdk
return;
}
GoSdkType goSdkType = GoSdkType.getInstance();
if (goSdkType.getSdkData() == null) {
goSdkType.setSdkData(sdkData);
}
Sdk existingSdk = ProjectJdkTable.getInstance().findJdk(goSdkType.getSdkLongName());
if (existingSdk == null) {
ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
String newSdkName = SdkConfigurationUtil.createUniqueSdkName(goSdkType, sdkData.GO_GOROOT_PATH, Arrays.asList(jdkTable.getAllJdks()));
ProjectJdkImpl goSdk = new ProjectJdkImpl(newSdkName, goSdkType);
goSdk.setHomePath(goRootPath);
goSdkType.setupSdkPaths(goSdk);
jdkTable.addJdk(goSdk);
ProjectRootManager.getInstance(project).setProjectSdk(goSdk);
} else {
ProjectRootManager.getInstance(project).setProjectSdk(existingSdk);