How to Install and Set Up Go (Golang) on Windows

90s kid who misses Cartoon Network and needs Nimbus 2000
Go (or Golang) is a powerful, open-source programming language developed by Google. It is widely used for building scalable and high-performance applications. If you're a Windows user, this guide will walk you through the installation and setup of Go on your system.
Prerequisites
Before installing Go, ensure you have:
A Windows 10 or later operating system.
Administrator access to install software.
A stable internet connection.
Step 1: Download the Go Installer
Open your browser and visit the official Go website: https://go.dev/dl/
Look for the latest Windows version of Go (e.g.,
go1.x.x.windows-amd64.msi).Click on the download link to save the
.msifile.
Step 2: Install Go on Windows
Locate the downloaded
.msifile and double-click to run the installer.Click Next on the welcome screen.
Accept the license agreement and click Next.
Choose the installation destination (default is
C:\Go), then click Next.Click Install and wait for the installation to complete.
Click Finish to exit the installer.
Step 3: Set Up Environment Variables
To ensure Go works properly, you need to verify its environment variables:
Open the Start Menu, search for Environment Variables, and open Edit the system environment variables.
In the System Properties window, click Environment Variables.
Under System Variables, locate
Pathand click Edit.Ensure
C:\Go\binis listed. If not, click New, enterC:\Go\bin, and click OK.Click OK on all windows to save changes.
Step 4: Verify Go Installation
To confirm Go is installed correctly:
Open Command Prompt (
cmd) or PowerShell.Type the following command and press Enter:
go versionYou should see an output similar to:
go version go1.x.x windows/amd64If you see this, Go is installed successfully!
Step 5: Set Up Go Workspace
Open File Explorer and navigate to your user directory (
C:\Users\YourUsername).Create a new folder named
go(this will be your workspace).Inside the
gofolder, create three subfolders:bin(for compiled binaries)pkg(for compiled package objects)src(for Go source code)
Open Command Prompt and run:
go envThis displays your Go environment variables. Ensure
GOPATHis set toC:\Users\YourUsername\go.
Step 6: Create and Run Your First Go Program
Open a text editor (such as Notepad++ or VS Code) and create a new file named
hello.goinsideC:\Users\YourUsername\go\src.Add the following code:
package main import "fmt" func main() { fmt.Println("Hello, Go!") }Open Command Prompt, navigate to the
srcdirectory:cd C:\Users\YourUsername\go\srcCompile and run the Go program:
go run hello.goYou should see:
Hello, Go!
Conclusion
You have successfully installed and set up Go on Windows! Now you can start exploring Go programming by creating projects and building applications. If you encounter any issues, refer to the official Go documentation: https://go.dev/doc/.
Happy coding!


