From cb37fb4b34e5d304a2ddfabab44544fa07431101 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Wed, 11 Jun 2014 18:39:51 -0700 Subject: [PATCH] Pick up system Go even if GOROOT isn't set Fixes #74 --- binscripts/gvm-installer | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/binscripts/gvm-installer b/binscripts/gvm-installer index dc122c5..8693425 100755 --- a/binscripts/gvm-installer +++ b/binscripts/gvm-installer @@ -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"