This is a part of my 24Days of Golang challenge preparation. If you don’t want to install Go locally, maybe you are just checking out the language and need no Internet capabilities, you can try Go playground.

Setup Instructions

Here’s a brief guide to setup your Go development Environment on Linux platform (Fedora 25) and Windows 10.

Linux | Fedora 25

I’m on Linux platform, and fortunately Golang package is already available in the repo! Here’re the instructions to install Go on Fedora 25. These instructions should be pretty much similar for Debian/Ubuntu linux flavor. Shamefully, ripped off from Fedora dev site

For tutorials, I’m using A tour of Go and couple other sources. All of this code is available on GitHub Golang Practice Note: A tour of Go is also available as a stand-alone/offline version.

go get
go tool tour
  • Go installation
  1. To install Go compiler, type:
$ sudo dnf install go

go, godoc and gofmt binaries will become available on the system.

  1. Go code lives in a workspace which is defined by GOPATH environment variable. Upstream documentation uses $HOME/work for your Go workspace:
  $ mkdir -p $HOME/work
  $ echo 'export GOPATH=$HOME/work' >> $HOME/.bashrc
  $ source $HOME/.bashrc
  1. Run go env to check that $GOPATH is set correctly:
  $ go env | grep GOPATH

Windows 10

Windows has a pretty good support for Golang, especially with Visual Studio Code.

Step 1 (Install Go for windows)

Download Golang for windows platform from here

Step 2 (Setup Environment variables & GOPATH)

Add these following to environment variables

  • Path variables : Add Golang to Path (C:\Go\bin or your Go install location) variables
  • GOPATH : This is your workspace directory (it should contain bin,pkg and src subfolders). Add it to user environment variables.
  • GOROOT : This is location where Go is installed on your system. Add it system environment variables.

Step 3 (Install Visual Studio code & Go extension)

Finally, you can download Visual studio code from here and then launch the visualstudio, and open up your workspace directory.

To install Go-lang support:

  • press ctrl + `
  • paste or type ‘ext install Go’
  • Install Go extension provided by lukehoban
  • Reload windows/visualstudio

Step 4 (optional) Run Go project site locally

Following command will start local Go project page (http://localhost:4000)

  $ godoc -http=:4000 -play -index


man + machine > problem