On Ubuntu systems, if you no longer need to use the Golang programming language, you can remove it from the system. This article will explain how to uninstall Golang in Ubuntu.
In Ubuntu, you can use the following command to uninstall Golang Packages:
sudo apt purge golang-go
This command will uninstall the Golang programming language and related software packages.
If you also installed other Golang related software packages, please add their names to the command, for example:
sudo apt purge golang-go golang-github-*
Note that when using the purge
command, Related configuration files and directories will be completely deleted, so use with caution.
Running Golang requires setting the GOPATH and GOROOT environment variables, so before uninstalling Golang, you need to delete the corresponding directories.
By default, the GOPATH directory is under $HOME/go
, and the GOROOT directory is under /usr/local/go
. Please use the following command to delete these directories:
rm -rf $HOME/go sudo rm -rf /usr/local/go
After you uninstall Golang in the system, you need to change the path in the PATH environment variable Golang related paths are deleted. This can be accomplished by editing the /etc/environment
file:
sudo vim /etc/environment
Then delete the following two lines:
GOPATH="$HOME/go" PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
Save and close the file, and restart the computer to ensure PATH Changes to environment variables take effect.
To sum up, the above are the steps to delete Golang on Ubuntu system. If you no longer need to use Golang, you can uninstall it from your system by following the steps above.
The above is the detailed content of How to delete golang in ubuntu. For more information, please follow other related articles on the PHP Chinese website!