Goroutine is very useful to execute a process asynchronously. You can use multiple goroutines to run multiple processes at the same time. But what if you want to wait for the goroutines to finish before continue to the next process? You can use WaitGroup to wait for goroutines to finish.
[Read More]Go: You Should Know This Before Using Defer
Defer is one of my favorite things in Go. You can use it to make sure operation is executed before a function returns. It is very useful. I think almost all Go programmer, if not all, has used defer
statement in their application. But there is one thing you should know before using defer in Go.
NSQ: Requeue vs Requeue Without Backoff
NSQ enables us to requeue a message with a delay duration. There are two functions to requeue messages, that is Requeue and RequeueWithoutBackoff. This article will show you the differences and help you choose the most suitable function for your use case.
[Read More]Redis Hash in Go With HSET, HGET and HGETALL
A hash is one of the data types in Redis. Redis hash is a map that that contains keys and their corresponding values. It is useful to store objects. Keys and values in Redis hash are string, but there are client libraries in Go to convert it to our type. In this article, I will show you how to use the hash data type in Redis.
[Read More]How to Use Redis in Golang
Many developers use Redis to cache data because it stores data in memory. It enables us to reduce load to our database or external service. Data stored in Redis have an expiration time, so Redis can release memory that is no longer used. This article will show you the basics of integrating Redis with Golang.
[Read More]SQL Query Timeout With Golang Context
One of Golang Context’s usage is to provide control over timeouts and cancelation. We can use this to control the timeout of SQL query execution and cancel it. This article will show you how to do that.
[Read More]Monitor Golang App With Prometheus and Grafana
As I have written before, monitoring your server’s metrics is important to maintain the reliability of your service. This article will show you the basics of monitoring your Golang application. The tools that we are going to use are Prometheus and Grafana.
[Read More]Update golang version Linux or macOS
This article will show you how to update Go to the newest version for Linux or macOS.
[Read More]