Introduction to Golang

Ikwechegh Ukandu
4 min readApr 9, 2020

--

In this article, I am going to tell you everything you need to know about Go lang, also called Go. According to the Go website, Go is an opensource programming language that makes it easy to build simple, reliable, and efficient software developed by a team at Google. The core developers include 1. Robert Griesemer
2. Rob Pike
3 .Ken Thompson

Go Logo

Go was built from concepts from other languages like Algol, Pascal, C, Modula, Oberon, Smalltalk and Newsqueak. Go inherited mostly from Oberon language and its syntax is from C. Go’s OOP is more like Smalltalk but in Go, you can attach methods to any type. And concurrency is mostly from Newsqueak which is a language also from Rob Pike and heavily inspired by Hoare’s paper of CSP (Communicating Sequential Processes). The langauge is called Golang because of its domain name golang.org but the proper name is GO. It was designed in 2007 to improve programming productivity at Google. The designers wanted to address criticism of other languages in use at Google, but keep their useful characteristics. Go was publicly announced in November 2009, and version 1.0 was released in March 2012. Go is widely used in production at Google and in many other organizations and open-source projects.

Why create a new language?

To answer this, we have to look at the very useful languages used at the time at Google. At the GO was designed, there were three languages that were the bedrock of Google’s productions. PYTHON, JAVA and C/C++. Each of this languages is very powerful on their own, however Google noticed that there was some loop holes which made the Go designers decide the bridge that gap. For example, python is very easy to use and the learning is not to huge but it is very slow because of the compile time because it is an interpreted language. Java is very quick but its type system has become very complex overtime (Its a natural trend for programming languages, they start out very simple but grows complex trying to implement additional use cases and features). Like java C and C++ is very quick but suffers the same complex type system and the learning curve is somewhat tiring. When C/C++ were designed, computers have considerable low memories unlike today, so a decision to maximize memory made C and C++ what they are today. In addition, all these applications were created at a time when multi threaded applications were extremely rare so concurrency in these languages were patched in at best.

Concurrency is when two tasks overlap in execution. In programming, these situations are encountered: When two processes are assigned to different cores on a machine by the kernel, and both cores execute the process instructions at the same time.

How Go solves these problems

The first thing you need to understand is that Go is a:

Strong and statically typed language.

variable types are explicitly typed

It inherits this feature set from java and c/c++. The type of the variable “name” cannot change overtime. We have explicitly told the compiler that the variable is a string. Static typing means that all your variables have to be designed at compile time. There are other ways around this if you dont want to statically declare variables but most of the time, you have to do this and enjoy the benefits that comes with static typing.

Re-declaring the variable the other way

Go has an excellent community

There are at least half a million programmers in the Go community. Just because Go is a nice language doesn’t guarantee its success. The Go community is committed to making new developers ramping on Go get the best experience as possible. Most notable companies are Google, Docker, Dropbox, Heroku, Medium, Lyft, Uber, and others.

https://www.tiobe.com/tiobe-index/
Stackoverflow
https://insights.stackoverflow.com/survey/2017#most-loved-dreaded-and-wanted
A chart showing that 36% of developers want to learn Go next, followed by Python and Kotlin — Freecodecamp

Concurrency

Concurrency is extremely important at our time. It allows multiple processes running simultaneously and effectively.

Golang has efficient concurrency, like C, C++, Java, and at the same time concurrency in Go is done much easier thanks to goroutines, channels, and garbage collection.

Let’s get our hands dirty a bit

Installation

To download the Go language, find the file for your machine here. install the Go language follow the instructions here.

We are going to learn some concepts in writing Go. Let’s an ASCII art…

Gopher it from code academy

An effective way to learn something new is by making something! In this project we’re going to incorporate the use of fmt to make ASCII art. One suggestion is to make a gopher:

This is my first article on Golang and i hope doing more as i learn more. yo can follow me on twitter here

--

--