go-tutorial

Install Go on Windows

You must first download it before proceeding with the installation. On golang.org, you can find all versions of Go for Windows.

Download Golang for your system architecture and then follow the installation instructions.

Step 1: Unzip the downloaded archive file after it has finished downloading. In the current directory, you will find a folder named go after unzipping.

Step 2: Paste the extracted folder wherever you want it to go. We’re going to install in C drive.

Step 3: Finally, configure the environment variables. Select Properties from the right-click menu on My PC. As illustrated in the photos below, select Advanced System Settings from the left side and then Environment Variables.

Step 4: From the system variables, select Path and then Edit. Then select New and enter the path to the bin directory where you pasted the Go folder. As seen in the screenshots below, we are modifying the path C:\go\bin and clicking Ok.

Step 5: Create a new user variable that informs the Go command where to get Golang libraries. To do so, go to User Variables and click New, as seen in the screenshots below.

Fill in GOROOT as the variable name, and the path to your Golang folder as the variable value. C:go is the Variable Value in this case. After that, click OK.

After that, click Ok on Environment Variables to finish your configuration. Now use the command go version on the command prompt to check the Golang version.

You have to create a folder on any drive and then a file which you can name anything with .go extension Following the installation, any IDE or text editor can be used to develop Golang code, which can then be run on the IDE or the Command prompt using the command:

Note :You have to move to your project directory using cd command and then run this command

go run filename.go

RECOMMENDED ARTICLES





Leave a Reply

Your email address will not be published. Required fields are marked *