How to uninstall Golang?

后端 未结 13 1575
猫巷女王i
猫巷女王i 2020-12-29 00:55

I tried the answer here Removed golang but go command still works?, but it didn\'t work (I can still run go)

Currently, when I run which go I see this o

13条回答
  •  -上瘾入骨i
    2020-12-29 01:38

    On linux we can do like this to remove go completely:

    rm -rf "/usr/local/.go/"
    rm -rf "/usr/local/go/"
    

    These two command remove go and hidden .go files. Now we also have to update entries in shell profile.

    Open your basic file. Mostly I open like this sudo gedit ~/.bashrc and remove all go mentions.

    You can also do by sed command in ubuntu

    sed -i '/# GoLang/d' .bashrc
    sed -i '/export GOROOT/d' .bashrc
    sed -i '/:$GOROOT/d' .bashrc
    sed -i '/export GOPATH/d' .bashrc
    sed -i '/:$GOPATH/d' .bashrc
    

    It will remove Golang from everywhere. Also run this after running these command

    source ~/.bash_profile

    Tested on linux 18.04 also. That's All.

提交回复
热议问题