Pick up system Go even if GOROOT isn't set

Fixes #74
This commit is contained in:
Michael Maltese
2014-06-11 18:39:51 -07:00
parent d108d7d500
commit cb37fb4b34
+7 -2
View File
@@ -18,9 +18,14 @@ update_profile() {
}
check_existing_go() {
if [ "$GOROOT" == "" ]; then
echo "No existing Go versions detected"
return
if which go > /dev/null; then
GOROOT=$(go env | grep GOROOT | cut -d"=" -f2)
else
echo "No existing Go versions detected"
return
fi
fi
echo "Created profile for existing install of Go at $GOROOT"
mkdir -p "$GVM_DEST/$GVM_NAME/environments" &> /dev/null || display_error "Failed to create environment directory"