moovweb/gvm

Which GVM echoes out script instead of location

Sylk opened this issue · 2 comments

Sylk commented

I'm running the command which gvm after installing completely but I get this output.

❯ which gvm
gvm () {
        if [[ "$GVM_ROOT" == "" ]]
        then
                display_error "GVM_ROOT not set. Please source \$GVM_ROOT/scripts/gvm"
                return $?
        fi
        if [[ -d $GVM_ROOT/.git ]]
        then
                mv "$GVM_ROOT/.git" "$GVM_ROOT/git.bak" || display_error "Failed to move git info out of the way"
        fi
        if [[ ! -d $GVM_ROOT ]]
        then
                display_error "GVM_ROOT does not exist. Please reinstall GVM"
                return $?
        fi
        mkdir -p "$GVM_ROOT/logs" > /dev/null 2>&1
        mkdir -p "$GVM_ROOT/gos" > /dev/null 2>&1
        mkdir -p "$GVM_ROOT/archive" > /dev/null 2>&1
        mkdir -p "$GVM_ROOT/archive/package" > /dev/null 2>&1
        mkdir -p "$GVM_ROOT/environments" > /dev/null 2>&1
        if [[ "$1" == "use" ]]
        then
                . "$GVM_ROOT/scripts/env/use"
                shift
                gvm_use "$@"
        elif [[ "$1" == "implode" ]]
        then
                . "$GVM_ROOT/scripts/env/implode"
                gvm_implode
        elif [[ "$1" == "pkgset" ]] && [[ "$2" == "use" ]]
        then
                . "$GVM_ROOT/scripts/env/pkgset-use"
                shift
                shift
                gvm_pkgset_use "$@"
        else
                "$GVM_ROOT/bin/gvm" "$@"
        fi
}

I don't know if this is related to the way that the installation process is described on linux but this feels quite wrong.

Was hoping there'd be a fun thing to try to fix here but: this is what which seems to do with this and similar programs where you install them by adding to your ~/.zshrc or ~/.bashrc

whereis gvm                                                                                                                                                                                                                             
gvm: /Users/dean/.gvm/bin/gvm

If you have nvm installed you can see a similar phenomenon with which nvm (I won't share the output because it's absolutely massive). If you have any alias's configured in your .bashrc or .zshrc, see what happens when you run a which against it.

@Sylk @DeanFoley kindly try this GO Version Manager: https://github.com/ankitcharolia/goenv