Writing Concurrent Tests In Golang

Golang provides excellent concurrency mechanism, including some built-in functionalities to run tests faster. In this blog post we’ll explore some useful techniques in running concurrent tests in Go. However, we will not cover basic knowledge of Golang syntax, concepts and how to write tests in Golang in this post. Basic tests Imagine we want to implement some helper functions for the slice data type. package slices // Unique returns true if slice does not contain any duplicates....

December 12, 2022 · 8 min

Graceful HTTP Server Shutdown In Golang

Golang is a fantastic programming language with so many features supported out of the box. One such feature is a full-fledged HTTP server, which requires only a few lines of code to start. However, not many people are aware of the mechanism to gracefully shut down the server. In fact even Golang's official HTTP server tutorial does not mention this important feature. In this blog post we’ll explore a problem with the hello world version of the HTTP server in Golang, and how graceful shutdown addresses it....

November 9, 2022 · 8 min

About DRY

DRY, which stands for Don’t Repeat Yourself, is a well-known programming principle. Many developers, however, misunderstand the principle, possessing a false grasp of what DRY is really about. In this blog post we’ll investigate a case in which DRY is misunderstood and applied in the wrong manner, and its consequences. A hypothetical code base written in Golang will be used to demonstrate the idea, but the syntax should be easy enough to understand even without Golang knowledge....

November 5, 2022 · 12 min

Useful Goland Shortcuts

As a developer who writes Golang everyday, high productivity is of utmost importance. Intellij Goland IDE provides so many useful features to reach this goal: from viewing the current staged changes to running a debugging session. After working with it for a few years I believe that Goland is an essential part of my work, and I’m willing to pay for the annual license even if my company does not. More than just a text editor, Goland provides a bunch of helpful shortcuts to help us execute trivial tasks quickly....

October 30, 2022 · 5 min

Signed Commit With SSH Keys

A commit can be signed locally before pushing to remote to ensure its authenticity. Why do we need that? Doesn’t the commit itself contain the author’s name and email? Well it turns out that it's possible to change the author's name and email of a commit. A signed commit, on the other hand, can ensure that the commit was originally made by the author who signed it using an SSH, or GPG, or S/MIME key....

October 14, 2022 · 4 min

Hello World Part 3: Custom Domain

In the previous post, we successfully pushed our source code to Github, and leveraged Github Pages to host our blog. We also explored Github action to set up an automatic build pipeline for our blog. In this tutorial we will learn how to deploy our blog using our own domain while still leveraging all of the tools Github provides. Domain purchase There are many services from which you could buy a domain....

July 23, 2022 · 3 min

Hello World Part 2: Leveraging Github Pages

We successfully created a blog in our local environment in the first part of this tutorial. Now it’s time to share it with the Internet. We will levarage Github pages as our hosting environment. Why? Because it’s free! Github Setup I’m gonna assume that you already got a Github account, and also installed git in your local machine. You should create a new repository in your Github, name it personal-blog, or any fancy name that you want....

July 19, 2022 · 3 min

Hello World Part 1: Creating a personal blog with Hugo

As I’m getting older it’s harder for me to remember things while I realize there are more things I need to learn. Improving my memory is important. Jotting things down so that I can revise later is also a good alternative. Go is a powerful programming language, and has been my “main” programming language for a few years by the time this post is being written. I’m excited to learn Hugo, and hopefully I can create something fun with it....

July 17, 2022 · 4 min