Go, Software Development

Install Golang without an installer in Windows

We do not need an installer to install Golang in Windows. We only need a zip version of its distribution and some environment variables to avoid system-wide impact like installers do. It sounds easy, but doing so requires some knowledge of DOS commands; therefore, it is not for newbies or non-technical people.

What Do We Need?

The essential requirement for this post includes the following.

  1. Windows 10 or 11 (if you already have it!)
  2. A text editor like Windows Notepad or Notepad++
  3. Manually install Golang using zip distribution (not an installer) for Windows (currently Go1.18) from its download page.
    • For Windows x86, download this
    • For Windows x64, download this
  4. Some knowledge of DOS commands
  5. Some Golang environment variables

Then, download the Golang zip distribution and extract it to some local directory, e.g., C:\Users\karldev\Desktop\dev\apps\go\go1.18. Immediately beneath this directory have the following subdirectories.

Next, please take note of that directory because we will use it in the next section.

Manually Install Golang in Windows

Once we download the Golang zip distribution and extract its content to some directory, we open a Windows command line. Then, set the following environment variable the command-line window to the path we extracted the Golang binaries.

For example, run the following command.

Setting the GOROOT environment variable is not enough. When we try running the go executable anywhere, it will not work.

Next, we need to append the PATH environment variable with a directory to the Golang bin directory. To do so, run the following command.

When we run the go executable from the same command-line window, we get the following output indicating that Golang now works from the command-line window.

IDEs use these, among others, two environment variables for configuration, allowing users to build and run Golang codes from within the code editors. For instance, GoLand uses the GOROOT variable to specify the path to the Golang SDK.

Using Golang Installer Instead?

If we do not want to deal with paths and DOS commands, we could use a Golang installer instead. Life is easier in this case, would you agree?

 

 

 

 

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like