/ GoLang

The Golang toolchain (visual studio code)

Install golang

Let's start by installing golang v1.10.2. We'll be doing for a linux box (mine is ubuntu 18.04), fireup your favrouite terminal and paste following command to install it (it will download about 123mb)

wget https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz && sudo tar -C /usr/local -xzf go1.10.2.linux-amd64.tar.gz && rm go1.10.2.linux-amd64.tar.gz

Setting up the environment

Open up your favroute text editor to edit ~/.profile, for vim use vim ~/.profile or for gedit use gedit ~/.profile. Now you need to append following lines to the end of the file

# So other tools know about our desired goroot
export GOROOT=$HOME/go

# Add bin to path
export PATH=$PATH:$GOROOT/bin

Testing the installation

Execute go version, it should produce something like go version go1.10.2 linux/amd64. If the go is not found, try the official documentation

For osx its as simple as executing brew install golang.

Setting up visual studio

Now launch visual studio code,

If its not installed, you can find latest version here

Now press Ctrl+P, it will prompt a floting textbox (possibly from the top), now paste ext install ms-vscode.Go and hit enter/return.

And walla, you have golang toolchain installed and setup with visual studio code

The toolchain contains useful tools for testing, building, linting and running go code (and much more).

Happy coding!

Dave Amit

Dave Amit

Howdy folks! I am Dave Amit, an accidental programmer, father to a lab puppy, hubby to a beautiful wife, addicted to puzzles & a noob blogger. This is my effort to simplify odd codes from the wild.

Read More