Command Pattern in Go (Golang)
This article will explain the command pattern, where to use it, and how to implement it in Go. The command pattern, as the name suggests, is used when we want…
Functional Options in Go: Implementing the Options Pattern in Golang
This post talks about what functional options are in Go, and how we can use the options pattern to implement them. Functional options take the form of extra arguments to…
Variables in Golang – Everything You Need to Know
This tutorial will explain how to work with variables in Golang, and some conventions used for idiomatic Go code. Variables in Go, just like in other languages, are used to…
Golang Constructors – Design Patterns For Initializing Variables
A constructor is a language feature that is used to initialize variables. The Go language doesn’t have any concrete “constructor” as such, but we can use a number of different…
Golang Make Function – Initializing Slices, Maps, and Channels (Size and Capacity)
Go has a special make function that can be used to initialize channels, slices, and maps. Using make, we can specify the memory and capacity constraints of the data type…
Using Maps in Golang – With Examples
Maps are a built-in data structure in Go that act as a collection of key-value pairs. They are also known as associative arrays, hash tables, or dictionaries in other programming…
A Complete Guide to JSON in Golang (With Examples)
In this post, we will learn how to work with JSON in Go, in the simplest way possible. We will learn how to convert from JSON raw data (strings or…
Time in Golang – Working With Time, Duration, and Dates (With Examples)
This tutorial will teach you how to work with Time in Go (Golang) - including how to parse and format date-time strings, add and subtract time durations, get the current…