How to Install Go on Windows: Step-by-Step Guide
To install
Go on Windows, download the official installer from the golang.org website, run the installer, and follow the setup prompts. After installation, verify by running go version in the Command Prompt.Syntax
Installing Go on Windows involves running an installer and using simple commands to verify the installation.
- Download Installer: Get the
.msifile from the official Go website. - Run Installer: Follow the setup wizard to install Go.
- Verify Installation: Use
go versionin Command Prompt to check if Go is installed correctly.
bash
go version
Output
go version go1.20.5 windows/amd64
Example
This example shows how to verify your Go installation on Windows after running the installer.
bash
C:\> go version
// Output shows the installed Go version and system infoOutput
go version go1.20.5 windows/amd64
Common Pitfalls
Common mistakes when installing Go on Windows include:
- Not adding Go to the system
PATH, sogocommands are not recognized. - Using an outdated installer instead of the latest version.
- Not restarting Command Prompt after installation to refresh environment variables.
Make sure to download the latest installer and restart your terminal after installation.
batch
REM Wrong: Trying to run go without PATH set C:\> go version 'go' is not recognized as an internal or external command REM Right: After installation and restart C:\> go version go version go1.20.5 windows/amd64
Output
'go' is not recognized as an internal or external command
go version go1.20.5 windows/amd64
Quick Reference
| Step | Action | Details |
|---|---|---|
| 1 | Download Installer | Visit https://go.dev/dl/ and download the Windows .msi file |
| 2 | Run Installer | Double-click the .msi file and follow the setup wizard |
| 3 | Verify Installation | Open Command Prompt and run 'go version' |
| 4 | Set PATH (if needed) | Installer usually sets PATH; if not, add Go's bin folder to system PATH |
| 5 | Restart Terminal | Close and reopen Command Prompt to apply changes |
Key Takeaways
Download the official Go Windows installer from golang.org to ensure latest version.
Run the installer and follow prompts to install Go on your system.
Verify installation by running 'go version' in Command Prompt.
Restart Command Prompt after installation to refresh environment variables.
Ensure Go's bin directory is in your system PATH for command access.