Install Go Programming Language (Golang) on Windows 10

Go, also known as Golang is a statically typed programming language developed at Google. To start programming with Go on your Windows 10 machine you will need to install Golang on your computer.

Installing Go on Windows 10 is relatively simple.You can find downloads to all supported platforms at Golang website. For Windows 10, simply download the file, double click, and complete the installation process.

Open the browser and navigate to the following url: https://golang.org/dl/. Click the link Microsoft Windows to download the Windows 64bit installer.

Download Golang 64bit for Windows 10

Double click the setup file, and complete the installation process with default options.

install go windows

Once the installer has completed, open the windows command prompt and execute go version go version command.

go version

If you get output with a version number, then Go is installed properly on your Windows 10 PC.

Check Go version on Windows 10

Setting Up Golang Development Environment

To set up Development Environment, the directory structure for Go projects needs to be created. First, we need to create the project folder(we will name it as go) and then inside the project folder we need to create three sub folders: src, bin and pkg.

In Windows 10, the project folder should be created in C:\Users\<USERNAME>, where <USERNAME> would be replaced with your Windows username (e.g., C:\Users\robst).

From the command line, we can use md command with USERPROFILE Environment variable to create folder structure.

md %USERPROFILE%\go\
md %USERPROFILE%\go\bin
md %USERPROFILE%\go\pkg
md %USERPROFILE%\go\src
Setting Up Golang Development Environment

The final step is to add GOPATH environment variable to the Windows system. We can do this using the following command:

go env -w GOPATH=%USERPROFILE%\go

Writing Your First Go Program: Hello World

Open any text editor, create a new file called "hello.go" and enter the following:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World")
}

Save the file and then use the following Go command to compile and run the program:

go run hello.go

You should see Hello, World displayed on your terminal.

Windows 10 golang hello world