How to Set Up Go Environment

Uninstalling and Installing Go on Ubuntu

How Extreme can you Go with Golang?

Golang brought me here, for technical writing purposes, and I'm excited about this. Indeed a journey of a thousand miles start with one step and today I make my first stride.

Before starting coding in Go, you need to have Golang environment. I'll take you through a step-by-step guide on checking whether you have golang installed on your machine, uninstalling the installed version and installing the desired version.

First, download your desired IDE

Checking for any installation

  • Run 'go version' command on your terminal

    You'll get a response like:

  •   go version go1.13.8 linux/amd64
    

Uninstalling Go

  • Locate Where Go files are stored by running:

  •   which go
    

    You'll get the path to Go directory as in the code snippet bellow

    Then delete the Go directory by running

rm -rf /usr/bin/go

/usr/bin/go - being the path to Go directory

With that, you'll have Golang uninstalled.

Installing Go

  • Download the desired Go version from Go official website

  • Using your terminal, navigate to the downloads

  • Extract the folder at the same time specifying the location for storage

  •   sudo tar -C /usr/local -xzf go1.20.2.linux-amd64.tar.gz
    
  • Add /usr/local/go/bin to the PATH environment variable

      export PATH=$PATH:/usr/local/go/bin
    

Then Restart your machine

Done, you're reading to start coding in Go

Let's Go extreme with Go