Kickstarting Your GoLang Journey

Written by meetgor | Published 2024/03/18
Tech Story Tags: golang | go | programming-languages | cloud-computing | web-development | devops | go-programming-challenge | coding-skills

TLDRJoin the 100-day Go Lang challenge and dive into the fundamentals of this modern programming language. Explore its applications in cloud computing, web development, and DevOps while following a beginner's journey through daily learnings and insights. Happy coding!via the TL;DR App


This is the first entry in my 100 days of Go Lang challenge. I will share the things that I learn, related to Golang or its configuration in my environment, each day for 100 days. In this post, we will discuss the basics of Go Lang and why you should learn it. It's not an in-depth guide but a high-level overview for getting started with Go Lang.

A bit of Context

In April 2021, I started learning Django and to date, I have more than 10 projects(not all deployed) created and publicly open on GitHub. It has been a great experience so far and I am still in between an internship with a project to be created in Django. The learning process after I started blogging in June 2021 has been a different fantasy, I have been enjoying the process of writing the things I learn. So, this Spring/Summer I am creating a challenge of 100 days for learning Go Lang and documenting the process. Hopefully, this will be a useful place to learn for a beginner and more than that a place for me to reflect on in the future.

Leaving the rant aside, let's start with the best question to answer, What is Golang?

What is Golang?

Golang (officially called Go) is a programming language developed by Google. It is statically typed like C\C++, Java, Kotlin, etc, with a syntax similar to dynamic languages like Python, Js, Ruby, Lua, etc. So, Golang provides the best of both worlds, the swiftness to write code and also providing control and memory safety.

Go is regarded as the language of the cloud i.e. it is heavily used in the cloud infrastructure, it involves creating microservices, APIs, containerization, orchestration, and a lot of other technologies. It can be a super useful programming language for DevOps folks and people into Cloud computing.

Although Go is designed for Cloud Infrastructure, that doesn't mean you can't use it elsewhere. There are a lot of fields in which Golang nicely fits. We'll discuss why you would want to learn Golang and state the domains where it can be used.

Go programmers are called Gophers

Why learn Golang?

There are a lot of reasons for learning Go as your next programming language. Not only it is quite famous but it is significantly faster than other programming languages like Python and Javascript. It is a simple language to pick up as it is designed for modern world technologies. There is an added advantage to learning Go Lang as it is a new programming language(not as old as Python). It was open-sourced in 2012 and has gotten a great boost in the last five years as cloud companies are on the rise.

1. GO lang is simple

GO lang is a simple programming language. It is quite similar to Python in terms of its syntax, although it also inherits characteristics from the Java/C++ paradigm. It has a single entry point program via the main function similar to Java/C++ languages and is compiled into binary/executable code before running. It has the standard library that provides a lot of functionalities out of the box. It provides some quite handy tools and has support for creating web applications in the core language itself.

2. GO lang is fast (Execution Speed)

Though it might not be the fastest language of all time, it beats Python and Javascript significantly in the context of backend development. Go lang is a compiled language and hence it has no overhead of converting into byte code or the interpreter. Go lang also checks for unused variables, functions, identifiers, and packages, this can boost the speed of execution by a good amount additionally optimizing the memory footprint of the program.

We can see, that Go lang is almost equivalent to C and C++ programming languages, though this might not be the best comparison of speed as it depends on quite a lot of factors and the context of programs. Still, Go lang has a significant edge over Java and C++ which is a great factor because of the writing complexity involved in those programming languages.

3. GO lang is fast (Writing Speed)

GO language is fast, yes I get that. It is faster in terms of writing speed. If you sit down to write the same code in Java/C++ or Go, having time constraints, you will move out with Go as a winner. It is much easier to write code in Go than compared to C/C++, Java, or even Javascript. Golang prefers clear code over fast code, though it might not be as fast as Rust or C++, it is definitely much easier and quicker to write than the other counterparts. Go is designed for writing software that can scale with large codebases and teams. So it's not a surprise it is used to create cloud computing technologies like Docker, Kubernetes, and other tons of cloud-native tools.

4. GO lang is made for the modern world

Go lang is the modern C

Go lang is a modern language, it is not as ancient as C/C++ or Java. It is designed for Cloud-native applications which are scalable and optimized for performance meeting the needs of the modern demand for bleeding-edge technologies. It is designed by the people who created the UNIX operation, Ken Thompson. Though there were other go authors like Robert Griesemer and Rob Pike. Go lang has been designed keeping the idea of C but also considering the context of the modern world. It makes tasks like concurrency a lot simpler but it avoids dangerous and manual control of memory by not allowing pointer arithmetic.

Where you can use Golang?

Go land finds its use case in a lot of domains including Cloud computing, Web applications, CLI and DevOps tools, and so on. As GO is a general-purpose programming language, you can use it anywhere in the relevant fields of technology.

Cloud-native applications

As Golang has capabilities to execute low-level system calls efficiently, cloud-native tools can be created in Golang to improve efficiency and memory usage. As Go uses fewer resources like CPU and memory, it can optimally be used for applications that require almost no delay in the response. It also handles concurrency very well using goroutines which are way simpler to implement. All these factors contribute very well to constructing a modern cloud-native application.

Golang is used in Cloud-native technologies like:

This makes Golang widely adopted and has firm grounds for the future as well.

Web applications

As Golang is highly efficient and fast it can be used to develop web applications. It can scale a web application very well as it is a statically typed ecosystem. It also has extensive support for integrating databases into web applications. Golang doesn't require any 3rd party integrations to create the web apps, it is developed using internal or external packages and modules. The performance of Golang is the core feature for creating web apps in it, it heavily outperforms Javascript(Node) and Python. As golang code is compiled before running, this makes a single executable depending on the operating system, this improves the performance to a great extent. So, golang should be an ideal choice for developing web applications.

DevOps tools

A lot of DevOps tools like Prometheus, Grafana, Terraform, and Hugo are written natively in Go. Having appropriate features like simplicity, scalability, efficiency, and concurrency, Golang fits the DevOps space really well. Golang is already used in cloud-native technologies as mentioned earlier adopting it in the DevOps space is a great choice as it creates an even and supportive ecosystem. The Write once and Run anywhere paradigm of Java is surprisingly built-in golang as well without conversion into byte code. This is a great feature any DevOps engineer would dream of, using a single code base for multiple platforms can save a lot of time and improve productivity.

  • Prometheus - Monitoring system and time series database
  • Grafana - Platform for monitoring and observability
  • Terraform - Building, Changing, and Versioning Infrastructure
  • Minikube - Run Kubernetes locally
  • Kit- standard library for microservices

Who uses Golang?

Golang is a widely used programming language, it is used by some of the big companies around the world. Of course, Google uses it, apart from Google, it is being used by companies like:

  1. Netflix
  2. PayPal
  3. Microsoft
  4. Dropbox
  5. Meta (facebook)
  6. Uber
  7. Twitter
  8. Twitch

There are so many tools created tools using golang like the gh-cli, cockrach-db, jwt, etc. You can see a whole list of applications/tools/frameworks written in Go from this awesome list

Conclusion

Go lang is an excellent choice for anyone into web development, cloud-native, DevOps, and CLI tools. Being a recently developed language, Go has grown a lot faster than any other language in the programming world. After learning Python over two years, I might want to dabble into Go but not completely leave Python. Python has a great community and is widely adopted in almost all fields of development. Still, trying out new things is what keeps you in the hunt for opportunities and meeting new people.

So starting from today, I will share my learning a new thing in Go lang every day for 100 days. At least that's the plan. The post might be in the form of a long post or a short TIL on the blog. Check out the GitHub repository for the 100-day challenge here. If you have any queries, suggestions, or feedback please let me know in the comments or on the mentioned social handles. Thank you for reading. Happy Coding :)

Also published here.


Written by meetgor | Backend Developer that lives in the terminal
Published by HackerNoon on 2024/03/18