Quick Introduction to Go language

Kenzy Limon
6 min readOct 18, 2022

--

Golang is one of the fastest-growing programming languages allowing developers to build fast, reliable, and efficient software that can scale with memory safety, garbage collection, and CSP-style concurrency.

All about Go

Golang is an open-source programming language developed by Google engineers to allow developers to build fast, reliable, and efficient software at scale with memory safety, garbage collection, structural typing, and CSP-style concurrency.

You might hear the language being called both Go and Golang, which might be confusing, Golang came from Go official website, golang.org. Sadly Go is still the official name.

Golang was designed to be scalable so that it can be used to tackle different issues. this allowed the language to thrive in a wide range of applications in systems development, web development, back-end development, and even cloud computing.

Go fucuss was primarily on the negative aspects of C++ and Java while maikng designing it to blend well with most IDEs, but not rellying on them.

History of Golang

Go is a young language, with its inception in 2007, created at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It was open-sourced in 2009, version 1.0 was later released in March 2012, After version 1.5, everything was written in Go including the compiler, linker, and assembler which were written in C.

Features in Golang

  • Easy to learn and get started with
  • Built-in strong concurrency and a robust standard library
  • High productivity & simplified usage
  • Outstanding level of code efficiency ( Concise and Clear )
  • No need for external dependency, Go can easily produce native binaries

Companies using Golang

Golang has been tried and tested with its distinct advantages, it has been the best choice for world-class products and industry giants.

Go’s value in producing clean, efficient code that readily scales as software deployment scales made the language a strong fit to support PayPal’s goals.
  • PayPal
  • Google
  • Netflix
  • Twitter
  • Uber

Best uses of Golang

  • StreamingSoundcloud uses Go for its ability to frequently get used files quickly and for the wide encoding formats Go Supports.
  • Cloud services — One famous cloud service is Google Cloud, which is developed on Go and offers scalability and high performance. one other cloud service platform using Go is Dropbox.
When we first released Go we didn’t know if the language would be widely adopted or if it might influence future languages. Looking back now, Go has succeeded in both ways.
  • Messaging — Around 10 million Slack users rely on Go’s special powers to effectively handle every Slack message post, push notification, URL unfurl, calendar reminder, and billing calculation.

“On our busiest days, the system processes over 1.4 billion jobs at a peak rate of 33,000 per second” — Slack

  • Gaming — Some of Go’s libraries (Goworld, Azul3D, Ebitengine)were developed for gaming. with games such as League of Legends using the language for its speed of development, reliability, cross-platform capabilities, and garbage collection which helps in memory.
  • Cybersecurity — Go Lang's speed, ease of use, and capabilities for data analysis have made it a prime option in server and cloud environments for developers who need to think about security. one company embracing this is 1Password.
  • Distributed Network Services — Using Using goroutines and channels, allows concurrency which is key to success in any networking environment. Go is suited to build network services such as APIs, web servers, and mini frameworks for web applications.
  • Command-line Interfaces (CLIs) — CLIs Developers find Go to be ideal for designing their applications. Go compiles very quickly into a single binary, works across platforms with a consistent style, and brings a strong development community. Tools that are widely used are Cobra & Viper. one such company embracing Go CLI is Github ✌️.

Installation guide

Installing Go on your computer is straightforward. Visit Golang and download the installer for the OS you are using.

Note: By default, the go the command downloads and authenticates modules using the Go module mirror and Go checksum database run by Google.

Windows installation guide

  1. Open the MSI file you downloaded and follow the prompts to install Go.
  2. By default, the installer will install Go to Program Files or Program Files (x86). You can change the location as needed. After installing, you will need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected in the command prompt.
  • Verify that you’ve installed Go.
  • In Windows, click the Start menu.
  • In the menu’s search box, type cmd, then press the Enter key.
  • In the Command Prompt window that appears, type the following command:
$ go version
  • Confirm that the command prints the installed version of Go.

Mac installation guide

  1. Open the downloaded package and follow the prompts to install Go.

The package installs the Go distribution to /usr/local/go. The package should put the /usr/local/go/bin directory in your PATH environment variable. You may need to restart any open Terminal sessions for the change to take effect.

2. Verify that you’ve installed Go by opening a command prompt and typing the following command:

$ go version

3. Confirm that the command prints the installed version of Go.

Linux installation guide

  1. Remove any previous Go installation by deleting the /usr/local/go folder (if it exists), then extract the archive you just downloaded into /usr/local, creating a fresh Go tree in /usr/local/go:
$ rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.2.linux-amd64.tar.gz
  • (You may need to run the command as root or through sudo).
  • Do not untar the archive into an existing /usr/local/go tree. This is known to produce broken Go installations.

2. Add /usr/local/go/bin to the PATH environment variable.

  • You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):
export PATH=$PATH:/usr/local/go/bin
  • Note: Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile.

3. Verify that you’ve installed Go by opening a command prompt and typing the following command:

$ go version

4. Confirm that the command prints the installed version of Go.

Tools and commands

The main Go distribution includes tools for building, testing, and analyzing code:

  • go build, which builds Go binaries using only information in the source files themselves, with no separate makefiles
  • go test, for unit testing and microbenchmarks
  • go fmt, for formatting code
  • go install, for retrieving and installing remote packages
  • go vet, a static analyzer looking for potential errors in code
  • go run, a shortcut for building and executing code
  • godoc, for displaying documentation or serving it via HTTP
  • gorename, for renaming variables, functions, and so on in a type-safe way
  • go generate, a standard way to invoke code generators
  • go mod, for creating a new module, adding dependencies, upgrading dependencies, etc.
We reach an end

Go’s approach to concurrency can be summarized as “don’t communicate by sharing memory; share memory by communicating” Meaning there are no restrictions on how go-routines access shared data making race conditions possible.

Golang is a general-purpose programming language. Meaning you can build almost anything in it, and you can easily integrate into other languages like C and Python due to their nature of being strongly connected to native ABI (Application Binding Interface).

I can comfortably say that programming in Golang is fun and it has grown to become my go-to language for most of my REST applications (microservices, monoliths). A space that competes with elixir and Nodejs.

Thank you for spending time reading this article, I hope you enjoyed what you read and learned something. If you have any feedback, kindly leave them in the comments below.

Want to keep in touch online? Medium | Twitter | Instagram | Youtube

--

--