Uninstall Golang From Windows: Step by Step With Images

Uninstalling programs from windows is a tedious task. It can land you in trouble if you delete the wrong files or modify settings incorrectly. This is why you need to take extra care while uninstalling any software from your windows machine. In this article, we will discuss two ways to uninstall golang from windows. The first approach discusses the steps to uninstall golang if you have installed using an MSI installer. The second approach discusses how to remove golang from windows if you have installed it using the source code.

Uninstall Golang From Windows if Installed Using the MSI Installer

If you had installed golang using the MSI installer, it is very easy to uninstall golang from windows. For this, we will discuss the steps in the following subsections.

Check if Golang Is Installed on Windows

To check if Golang is installed on your computer, open the command prompt and execute the command “go version”.  If golang is installed on your machine, the golang version will be printed as shown below.

check golang version
check golang version

In the above output, you can observe that executing the command go version gives us the version of golang on our machine. Hence, it proves that golang is installed on the machine.

Uninstall Go Using the Control Panel

To uninstall golang if you installed it using the MSI installer, go to the control panel. Then, click on Programs.

Control Panel Screenshot
Control Panel Screenshot

After clicking on Programs, you will get the following screen.

Control Panel Screenshot
Control Panel Screenshot

In the above screen, Click on Uninstall a Program. Then, you will get a list of all the programs as shown below.

Control Panel Screenshot
Control Panel Screenshot

In the above screen, go to the entry for Golang. Then, right-click on the entry for golang. After clicking, you will get two options i.e. Uninstall and Repair as shown below. 

Control Panel Screenshot
Control Panel Screenshot

To uninstall golang from your windows machine, click on Uninstall on the above screen.

After that, you will get the following prompt asking you to confirm if you want to uninstall golang from your windows machine. Click on Yes to proceed ahead.

Prompt
Prompt

After clicking on the Yes button, the uninstallation process will start. You will get an output on the screen as shown below.

Go Screenshot
Go Screenshot

After completion of the above process, you can observe that the Golang program has been removed from the list of installed programs. Hence, Golang has been successfully removed from your machine.

Go Screenshot
Go Screenshot

Verify if Golang Has Been Uninstalled

To verify if golang has been removed from your windows machine, open the command line terminal and check the version of Golang by using the “go version” command. If the execution of the commands causes an error, it means that golang has been removed from your windows machine.

Go Screenshot
Go Screenshot

In the above image, you can observe that the command prompt has run into CommandNotFoundException. Thus, golang has been removed from the system.

If you want to reinstall golang after removing it, you can read this article on how to install golang in windows.

Uninstall Golang From Windows if Installed by Downloading the Source Code

If you have installed Golang on your system using the source code file, you won’t be able to uninstall it directly using the control panel. For this, you can follow the steps discussed below.

Delete Source Code Files of Golang

To uninstall golang if you have installed it using the source code file, you first need to delete the folder containing the golang source codes. For this, go to the directory where you have installed golang. Scroll to the folder named go as shown below.

Go Screenshot
Go Screenshot

On the above screen, right-click on the go folder. You should see the options as shown below.

Golang Screenshot
Golang Screenshot

In the above screen, click on the delete button and confirm the deletion. The system starts deleting the source code files of golang as shown below.

Golang Screenshot
Golang Screenshot

After deleting the source code files, we need to let the windows system know that the file has been deleted. For this, we will delete the environment variables related to the golang program.

Update Environment Variables After Deleting Golang Source Codes

To update the environment variables, go to Settings> System> About. There, you will get the advanced system settings button as shown below.

Golang Screenshot
Golang Screenshot

Click on the Advanced system settings button. You will get the screen given below.

Golang Screenshot
Golang Screenshot

Now, we have to modify the environment variables. Therefore, click on the Environment Variables button. After clicking on the Environment Variables button in the above screen, you will get the following screen.

Uninstall Go Screenshot
Uninstall Go Screenshot

In the above screen, there are two sections namely User Variables and System Variables

The User Variables section contains the path to the go folder in the GOROOT variable. We need to delete this variable. For this, click on GOROOT and select it. After selecting the variable, click on the Delete button below the User Variables. This will delete the GOROOT variable.

In the following image, you can observe that the GOROOT variable has been removed from the User Variables.

Uninstall Go Screenshot
Uninstall Go Screenshot

The Path variable in the System Variables dialog contains the path to the go/bin folder. We need to delete the path too. For this, Scroll through the System Variables dialog and go to the Path variable.

Click on the Path variable and select it as shown below.

Uninstall Go Screenshot
Uninstall Go Screenshot

After selecting the Path variable, Click on the Edit button. You will get the following screen containing paths to various programs. 

Uninstall Golang Screenshot
Uninstall Golang Screenshot

In the above list, select the Path to go\bin folder by clicking on it. After selecting the path, click on the Delete button. Once you click the Delete button, the path to the go\bin folder will be removed from the Path variable. You can observe this in the following image.

Uninstall Golang Screenshot
Uninstall Golang Screenshot

Now that you have deleted the path, click on the OK button. You will be taken to the Environment Variables screen. Click on the OK button there too. After that, golang will be successfully uninstalled from your windows system without causing any unwanted errors.

Verify if Golang Is Uninstalled

To verify if golang has been uninstalled from your windows system, open the command line terminal and check the version of Golang by using the “go version” command. If the execution of the command causes an error, it means that golang has been removed from your windows machine.

Uninstall Golang Screenshot
Uninstall Golang Screenshot

In the above screenshot, you can see that the terminal window shows the CommandNotFoundException error. Hence, we have successfully uninstalled golang from the windows system even if it was installed using the source code file.

Conclusion

In this article, we have discussed two ways to uninstall golang from windows. The first approach covers the situation if you have installed golang using the MSI installer. The second approach discusses how to uninstall golang from windows if you have installed it using the source code files.

I hope you found this article useful. To learn more about programming, you can read this article on python simplehttpserver. You might also like this article on ValueError exception in Python.

Stay tuned for more informative articles. Happy Learning!

Leave a Reply