• Home
  • Go Programming Language

Go Programming Language

Go What?

Go is a programming language created by a team of developers at Google, led by three primary engineers Robert Griesemer, Rob Pike, and Ken Thompson. Development began in 2007 and Go was released to the public in 2009. Go also benefits from a large open source community of contributors.

Go is a system language (compiled) and not a scripting language (interpreted), therefore it is more comparable to C than Ruby or Python. The goal of the Go creators was to create a language, loosely based on the C syntax, which would eliminate the extraneous features of languages such as C++. As a result, Go does not include many of the “features” of modern languages, such as method and operator overloading, pointer arithmetic, and type inheritance.

Go Why?

Go improves upon some of the misgivings of existing popular system languages. Misgivings such as:
• Poor dependency management
• Cumbersome type systems
• Difficult memory management
• Lack of parallel computation support
• Lack of multi-core support
Go also attempts to be more expressive so that less code must be written to accomplish a given task. High performance is one of the biggest draws to use Golang. This performance is due in large part, to static compilation and statically-typed code. Another benefit of using Go is its native concurrency support using goroutines and channels. A goroutine is a function that can run concurrently with other functions and any normal function in Go can be made into a goroutine using a simple, single keyword signature. Channels provide a way for two goroutines to communicate with one another and synchronize their execution. This type of implicit support for concurrency and synchronization is quite appealing.

Go How?

For this section, we can utilize an existing tool/site: http://tour.golang.org/welcome/1
This site will take us through the basics of the Go language and its syntax, while offering a sandbox in the same page as well.

Setup using Docker

It is important to remember that the environment configuration for Go has some atypical setup requirements. Primarily you will need a specific folder structure and some environment variables for the Go compiler to work correctly. The easiest way to setup this environment and get programming is to use Docker. The following Dockerfile will setup our Golang environment isolated in a container of its own so that we do not have to alter our local system.
Using the tutorial at: https://medium.com/statuscode/golang-docker-for-development-and-production-ce3ad4e69673#.7fdjmuhun we can write a single Dockerfile that will allow us to build a development container that will reload our code as it changes and which supports the type of quick on-boarding we need. This means we will not have to install anything and we will not have to configure any environment variables or setup a specific folder structure, all of which we would need if we wished to setup Go locally.

Setup Locally

If you decide to commit to some Go development you will need to do a local installation likely, unless you decide to continue using Docker only for development. If you do wish to install Go you must remember to configure the GOPATH environment variable and at that path add three folders: #GOPATH/bin, #GOPATH/pkg, and #GOPATH/src. These folders are required for Go to function properly. All source files need to be located below the src folder in this structure. When you use the Go compiler to compile your source into an executable it is place inside of bin, and of course pkg is for dependencies. For a complete guide to installing Go onto a Windows system use the instructions at this url: http://www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/.

Now Go!