Giter Site home page Giter Site logo

install gvm lead to cd commad failed about gvm HOT 4 OPEN

sheepcat avatar sheepcat commented on June 9, 2024 2
install gvm lead to cd commad failed

from gvm.

Comments (4)

goFrendiAsgard avatar goFrendiAsgard commented on June 9, 2024

I got a similar issue.

Can you please confirm the value of your $PATH before and after installing gvm?

echo $PATH

In my case, I have a PATH containing space that accidentally replaced by :

https://twitter.com/gofrendiasgard/status/1695596852127941055

from gvm.

codingcn avatar codingcn commented on June 9, 2024

same issues

/home/chris/.gvm/bin:/home/chris/.config/nvm/versions/node/v14.21.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/usr/local/go/bin:/home/chris/go/bin
chris@chris-PC:~$ type cd
cd 是函数
cd () 
{ 
    if __gvm_is_function __gvm_oldcd; then
        __gvm_oldcd $*;
    fi;
    local dot_go_version dot_go_pkgset rslt;
    local defaults_go_name defaults_go_pkgset;
    local defaults_resolved=false;
    local defaults_hash;
    defaults_hash=();
    if [[ "$GVM_ROOT" == "" ]]; then
        display_error "GVM_ROOT not set. Please source \$GVM_ROOT/scripts/gvm";
        return $?;
    fi;
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Resolving defaults...";
    defaults_hash=($(__gvm_read_environment_file "${GVM_ROOT}/environments/default"));
    if [[ $? -eq 0 ]]; then
        defaults_resolved=true;
    else
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Can't find default environment. Falling back to system.";
        defaults_hash=($(__gvm_read_environment_file "${GVM_ROOT}/environments/system"));
        if [[ $? -eq 0 ]]; then
            defaults_resolved=true;
        else
            [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Can't find system environment.";
        fi;
    fi;
    if [[ "${defaults_resolved}" == false ]]; then
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Resolving fallback go version and pkgset from all available.";
        local fallback_go_version="$(__gvm_resolve_fallback_version)";
        local fallback_go_pkgset="$(__gvm_resolve_fallback_pkgset "${fallback_go_version}")";
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "=======================================";
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "fallback_go_version => $fallback_go_version";
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "fallback_go_pkgset => $fallback_go_pkgset";
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "=======================================";
        defaults_hash=($(setValueForKeyFakeAssocArray "gvm_go_name" "${fallback_go_version}" "${defaults_hash[*]}"));
        defaults_hash=($(setValueForKeyFakeAssocArray "gvm_pkgset_name" "${fallback_go_pkgset}" "${defaults_hash[*]}"));
        unset fallback_go_version;
        unset fallback_go_pkgset;
        defaults_resolved=true;
    fi;
    defaults_go_name="$(valueForKeyFakeAssocArray "gvm_go_name" "${defaults_hash[*]}")";
    defaults_go_pkgset="$(valueForKeyFakeAssocArray "gvm_pkgset_name" "${defaults_hash[*]}")";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "defaults_go_name => $defaults_go_name";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "defaults_go_pkgset => $defaults_go_pkgset";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
    if [[ "${GVM_DEBUG}" -eq 1 ]]; then
        echo "Resolved default go: ${defaults_go_name:-[EMPTY]}";
        echo "Resolved default pkgset: ${defaults_go_pkgset:-[EMPTY]}";
    fi;
    dot_go_version="$(__gvmp_find_closest_dot_go_version)";
    rslt=$?;
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "---------------------------------------";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "dot_go_version => $dot_go_version";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "defaults_go_name => $defaults_go_name";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "---------------------------------------";
    if [[ $rslt -eq 0 ]]; then
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Found dot_go_version: ${dot_go_version}";
        local use_goversion="$(__gvmp_read_dot_go_version "${dot_go_version}")";
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Switching to: ${use_goversion}";
        gvm use "${use_goversion}" || return 1;
        unset use_goversion;
    else
        if [[ -n "${defaults_go_name}" ]]; then
            [[ "${GVM_DEBUG}" -eq 1 ]] && echo "No .go-version found. Using system or default go.";
        else
            if [[ "${GVM_DEBUG}" -eq 1 ]]; then
                echo "No fallback go version could be found.";
                if [[ ! -d "$GVM_ROOT/archive/go" ]]; then
                    echo "$(locale_text_for_key "go_install_prompt")";
                fi;
            fi;
            return 0;
        fi;
    fi;
    dot_go_pkgset="$(__gvmp_find_closest_dot_go_pkgset)";
    rslt=$?;
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "--------------------------------";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "dot_go_pkgset => $dot_go_pkgset";
    [[ "${GVM_DEBUG}" -eq 1 ]] && echo "--------------------------------";
    if [[ $rslt -eq 0 ]]; then
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Found .go-pkgset: ${dot_go_pkgset}";
        local use_gopkgset="$(__gvmp_read_dot_go_pkgset "${dot_go_pkgset}")";
        [[ "${GVM_DEBUG}" -eq 1 ]] && echo "Switching to: ${use_gopkgset}";
        gvm pkgset use "${use_gopkgset}" || return 1;
        unset use_gopkgset;
    else
        if [[ -n "${defaults_go_pkgset}" ]]; then
            [[ "${GVM_DEBUG}" -eq 1 ]] && echo "No .go-pkgset found. Using system or default pkgset.";
            [[ "${GVM_DEBUG}" -eq 1 ]] && echo "----------    defaults_go_pkgset => $defaults_go_pkgset     ----------";
        else
            [[ "${GVM_DEBUG}" -eq 1 ]] && echo "No fallback pkgset could be found.";
        fi;
    fi;
    return 0
}

from gvm.

clanaid avatar clanaid commented on June 9, 2024

how to fix it?

from gvm.

ankitcharolia avatar ankitcharolia commented on June 9, 2024

@clanaid @codingcn @sheepcat : Kindly try out this one. this supports bash and zsh both shells : https://github.com/ankitcharolia/goenv

from gvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.