Contents

Golang setups in Windows and Unix enviroments

Setup Golang is not that hard. To install golang your can go to golang downloads .

Windows

If you are going to install on windows you can download windows binaries of 32/64 architects

/images/uploads/screenshot-from-2023-08-22-12-05-41.png

if you are planning to download the compressed files, you have to set path variables in system environment.

or you can install the installer with msi version, which will install and do all the necessary settings for you.

you can also work with Linux environment using Windows Subsystem for Linux (WSL) .

Windows has provided good article for installing WSL in your machine wsl installtion

Linux

Go binary distributions are available for these supported operating systems and architectures. Please ensure your system meets these requirements before proceeding. If your OS or architecture is not on the list, you may be able to install from source or use gccgo instead.

/images/uploads/screenshot-from-2023-08-22-12-26-20.png

Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:

1
2
tar -C /usr/local -xzf go.x.tar.gz

Setup Go Environment

Add this to your ~/.bashrc file

GOROOT is the location where Go package is installed on your system.

1
2
export GOROOT=/usr/local/go


GOPATH is the location of your work directory. For example my project directory is ~/go, you can create what ever folder structure you want.

1
2
export GOPATH=$HOME/go

Sytem wide PATH setting

1
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

If you want to install to any specific Linux distribution, lets say Fedora.

you can install with the command

1
sudo dnf install golang

this will install latest stable version in your system.

To check the go version installed in your system

1
2
go version

this will show the go version in your terminal

/images/uploads/screenshot-from-2023-08-22-12-42-45.png

Get all go evironment variable settings.

1
go env

/images/uploads/screenshot-from-2023-08-22-12-45-52.png