Using ‘Go Generate’ To Deploy Multi-Process Apps

GE 740x520 1

In microservice architectures, it’s fairly common to have a project that includes different worker types. A Makefile can be used to manage the creation of multiple programs, but the Go toolchain has a tool that can be used as well, go generate. Here are some examples of how it can be used: API/Worker – We …

Read more

What Are Golang’s Anonymous Structs?


An anonymous struct is just like a normal struct, but it is defined without a name and therefore cannot be referenced elsewhere in the code. Structs in Go are similar to structs in other languages like C. They have typed collections of fields and are used to group data to make it more manageable for …

Read more

Wrapping Errors in Go – How to Handle Nested Errors

photo 1495863367063 b9ac3e6394f7

Errors in Go are a hot topic. Many newcomers to the language immediately level their first criticism, “errors in go are clunky! Let me just use try/catch!” This criticism is well-meaning but misguided. The paradigm of errors as a type, rather than something to be thrown and cause panics, allows for more control of how …

Read more

Top 6 Golang Logging Best Practices

guest writing on table

Let’s discuss a few rules of thumb for logging in Go, as well as some features you may not have heard of that can make debugging easier. Best practices for logging in Go are not so obvious and sometimes we need to look closer to see what is the best choice, considering the unique situation …

Read more

How to Create Constant Maps, Slices, & Arrays in Golang

How to Create Constant Maps and Slices in Go

For the most part, I’ve found that Go developers are pretty good at using global constants for configuration rather than global variables. However, a problem arises when we want a constant version of some of the more complex types. The Go compiler does not allow us to create array, map, or slice constants. After realizing …

Read more