Golang is one of the youngest programming languages. Until this post is published, the current stable Golang version is 1.17.2. Besides that, it is considered a popular programming language amongst developers. It can be built and run on many platforms and environments (Sorry, Java), bundled with solid and supportive built-in packages, and many more.
I use Golang due to the lack of magic of the language, verbose, structured, and clean. Within this article, you are going to discover reasons why you should consider learning Golang. I’m not going to compare Golang with other programming languages because I think that will end in smoke. So let’s start with the language structure itself.
I will not cover all the language syntax, but the code above is an example of Golang’s code. You don’t need to understand it right now, but you can learn the structure of the code starts from the
import as a code scope,
func main as an entry point,
for loop as one of the control structure,
strictly typed, using
curly braces as scope even though you only write a single line of control structure, using
nil instead of
null (you save 1 character here), and only using a semicolon to separate statements, not to ends it. All that said, Golang’s syntax is beginner-friendly, at least that’s what I thought.
You won’t be afraid of writing a dirty code syntax or whatsoever, because not only Golang has its guide to writing it better, it also has its own
formatter that tells you what variable is unused built right in. And that’s what you’re gonna know about.
Golang brings its own tools to build a great application. Linter? Formatter? Tester? You named it. It also has a
garbage collector, natively support concurrency, and a playground. Besides that, Golang also has supportive built-in packages. You can write a web application, command-line interface application, and even a Web Assembly application without any third-party module. But, what if you want to create a Golang module? Let’s talk about it.
You can create a Golang module easily both local and remote. Just execute
go mod init <module-name> and then just code like usual. Golang module support git out of the box, you can just push your Golang module to a git repository, and then import it into your code. For example, if you want to import a Postgres plugin or my database credential rotator module, you can import it just by typing the git repo name.
Binary! Golang builds your code into a binary. If you are on Windows, it will build your code into executable files, if you are on Linux it will build an ELF file, and so on. Also, you can control the build by only using an Environment variable. Let’s say you are on a Linux machine, but you want to create an executable file for windows, just tell it so.
You can also create a Web Assembly module:
I know that I’m not covering all the language specifications. All the reasons above are quite subjective to me as a developer, you may find your interests in Golang by referring to the FAQ page or the specification page. Also, Golang is on its way to the 2nd version which will support Generic and better error handling.
Thank you for reading!