Skip to content

Commit

Permalink
Improvements when adding a golang.org sdk on MacOSX.
Browse files Browse the repository at this point in the history
Closes go-lang-plugin-org#156

Signed-off-by: Mihai Claudiu Toader <mtoader@gmail.com>
  • Loading branch information
mtoader committed Dec 17, 2012
1 parent 9c9514c commit 84ae426
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<ul>
<li>[bugfix] Guard against a NPE when looking at old Go App Engine SDK's.</li>
<li>[bugfix] Properly scan for a sdk in windows with go 1.0.3.</li>
<li>[bugfix] Properly scan for a sdk in osx with go installed from golang.org / brew / compiled by hand.</li>
</ul>
<h3>0.9.12 changes:</h3>
<ul>
Expand Down
8 changes: 5 additions & 3 deletions src/ro/redeul/google/go/sdk/GoSdkUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class GoSdkUtil {
Pattern.MULTILINE);

private static Pattern RE_ROOT_MATCHER =
Pattern.compile("^(?:set )?GOROOT=(.+)$", Pattern.MULTILINE);
Pattern.compile("^(?:set )?GOROOT=\"?(.+)\"?$", Pattern.MULTILINE);

@SuppressWarnings({"SynchronizationOnLocalVariableOrMethodParameter"})
public static GoSdkData testGoogleGoSdk(String path) {
Expand Down Expand Up @@ -477,8 +477,10 @@ public static String resolvePotentialGoogleGoHomePath() {
}

String command = "go";
if (GoUtil.testPathExists("/usr/lib/go")) {
command = "/usr/lib/go";
if (GoUtil.testGoHomeFolder("/usr/lib/go")) {
command = "/usr/lib/go/bin/go";
} else if (GoUtil.testGoHomeFolder("/usr/local/go")) {
command = "/usr/local/go/bin/go";
}

String path = System.getenv("PATH");
Expand Down
8 changes: 5 additions & 3 deletions src/ro/redeul/google/go/util/GoUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ private static File getIdeaHomeDir() throws IOException {
}
}

public static boolean testPathExists(String goRoot) {
return goRoot != null && goRoot.trim().length() > 0 && new File(goRoot).isDirectory();
public static boolean testGoHomeFolder(String goRoot) {
return goRoot != null
&& goRoot.trim().length() > 0 && new File(goRoot).isDirectory();
}

private final static Pattern RE_PACKAGE_TARGET = Pattern.compile("^TARG=([^\\s]+)\\s*$", Pattern.MULTILINE);
private final static Pattern RE_PACKAGE_TARGET =
Pattern.compile("^TARG=([^\\s]+)\\s*$", Pattern.MULTILINE);

/**
* Returns a string if there is a TARG=xxx specified in the provided makefile and null if there is no such file.
Expand Down

0 comments on commit 84ae426

Please sign in to comment.