How to uninstall Golang?

后端 未结 13 1505
猫巷女王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条回答
  • 2020-12-29 01:24

    For Windows 10:

    1. Go to Apps in the Settings App.
    2. Look for Go Programming Language * in the list and uninstall it.
    3. Remove C:\Go\bin from your PATH environment variable (only if you don't plan on installing another version of golang)
    0 讨论(0)
  • 2020-12-29 01:25

    You might try

    rm -rvf /usr/local/go/
    

    then remove any mention of go in e.g. your ~/.bashrc; then you need at least to logout and login.

    However, be careful when doing that. You might break your system badly if something is wrong.

    PS. I am assuming a Linux or POSIX system.

    0 讨论(0)
  • On a Mac-OS Catalina

    1. need to add sudo before rm -rf /usr/local/go sudo rm -rf /usr/local/go otherwise, we will run into permission denial.

    2. sudo vim ~/.profile or sudo ~/.bash_profile remove export PATH=$PATH:$GOPATH/BIN or anything related to go lang

    3. If you use Zsh shell, then you need to remove the above line to ~/.zshrc file.

    Hope it helps you :)

    0 讨论(0)
  • 2020-12-29 01:34

    Update August 2019

    Found the official uninstall docs worked as expected (on Mac OSX).

    $ which go
    /usr/local/go/bin/go
    

    In summary, to uninstall:

    $ sudo rm -rf /usr/local/go
    $ sudo rm /etc/paths.d/go
    

    Then, did a fresh install with homebrew using brew install go. Now, i have:

     $ which go
    /usr/local/bin/go
    
    0 讨论(0)
  • 2020-12-29 01:35

    In MacOS, you can just do it with brew:

    brew uninstall go
    brew install go
    brew upgrade go
    
    0 讨论(0)
  • 2020-12-29 01:37

    I'm using Ubuntu. I spent a whole morning fixing this, tried all different solutions, when I type go version, it's still there, really annoying... Finally this worked for me, hope this will help!

    sudo apt-get remove golang-go
    sudo apt-get remove --auto-remove golang-go
    
    0 讨论(0)
提交回复
热议问题