Why Golang?



Imagine you are having not one, but a couple of yodas in computer science to work on the same language.

I am not saying nothing could go wrong with this team, but this is good enough for me to check the language out.

Purpose of the Project

Go was designed to address the problems faced in large scale software development, with concurrency
and maintainability built in its core.

When Go launched, some claimed it was missing particular features or methodologies that were regarded as de rigueur for a modern language.

How could Go be worthwhile in the absence of these facilities? Our answer to that is that the properties Go does have address the issues that make large-scale software development difficult. These issues include:

Individual features of a language don’t address these issues. A larger view of software engineering is required, and in the design of Go we tried to focus on solutions to these problems.

Reference: Go Frequently Asked Questions


Gopher is the best representation of the language imo.
It’s simple, it’s fun. It helps me solve complex problems with simple solutions.

Developer Productivity

Having the expressiveness of dynamic languages, with the performance of compiled languages.

Golang is fast. And it is not just about the performance and compilation time. It also provides all kinds of features and tools for the developers to be more productive.

Here are some reasons that I think Golang stands out in terms of developers’ productivity.

a) Public vs Private function

Does it bothers you when you first started learning Java with public static void without really knowing what it means?

Instead of using a public/private keyword, Go uses initial letter of the identifier to determine the visibility.

package hello

import "fmt"

// hello as some private function
// Not visible outside of the package
func hello() {
    fmt.Println("I am a private function")

// SayHello is a public function
// As the func name is starting with Capital letter
func SayHello() {
    fmt.Println("I am a public function")

b) Documentation

You can generate a package documentation in the command line with go doc --all

or html format with godoc -http=localhost:7000

c) go fmt

Gofmt’s style is no one’s favorite, yet gofmt is everyone’s favorite.

-Rob Pike

With Go, it takes an unusual approach and let the machine take care of the most controversial formatting issues.

Less time can be spent on the discussion on whether 2 spaces or 4 spaces or tab or vertical comments alignment should be used. It also makes you feel ‘consistent’ to read code written by others.

Auto formatting on save with go fmt

d) Compiled Language

Because Go compiles so fast, it gives you the benefit of a compiled language (type checking, efficiency, etc..) and makes you feel like writing in an interpreted language as well.

Here is an example of how you can be benefit from a compiler (Easier to detect error and restructure code, etc..).

Function Signature checking

Companies using Golang

Why Golang? It is battle tested.

Many big companies are using Go programming language in various projects and services due to its scalability, superior error check, and concurrency. Here are some big companies which are using Golang:

Reference: Companies using Go

Developer Survey

In February 2020 StackOverflow conducted a survey with nearly 65,000 developers on how they learn and level up, which tools they’re using, and what they want. Here are some take aways on Golang.

Reference: 2020 Stack Overflow Developer Survey

What about Data science

Nothing. Who says everything is about DS.

Just kidding 🙂. The truth is data science will not be the main focus of Go in near future. It is being more widely used in areas like, DevOps, Cloud architecture, web development, API/RPC services, etc..

I do find Go very easy to use for data scraping and hosting API.

Final Thoughts

Some final thoughts

Recommended Readings

Parse JSON API response in Go

Parse HTTP API response easily in Go.

Functional Options in Go

A nice way to set options in Go.