How and Why to Write Enums in Go

list with pencil and paper

An enum (short for enumerator), is a set of named constant values. An enum is a powerful tool that allows developers to create complex sets of constants that have useful names yet simple and unique values. Syntax Example Within a constant declaration, the iota keyword creates enums as successive untyped integer constants. Why should you use enums? Let’s look at …

Read more

Splitting a String into a Slice in Golang

splitting a lemon

I can’t begin to tell you how often I split strings in Go. More often than not I’m just parsing a comma-separated list from an environment variable, and Go’s standard library gives us some great tools for that kind of manipulation. Table of Contents Split by commas or other delimiters strings.Split strings.SplitN Split by delimiters …

Read more

All the Ways to Write for Loops in Go

loop architecture

A for loop executes a block of code repeatedly, and in Golang, there are several different ways to write one. The standard three-component loop For-range loop Range over slice Range over map Range over channel Range over string While loop Optional components loop Infinite loop Break from a loop Continue (skip to the next iteration) …

Read more

Should You Commit the Vendor Folder in Go?

Should You Commit Your Vendor Folder in Go

The answer to the age-old question of, “should I commit the vendor dependencies in my Go project to source control?” is “almost always“. As an FYI, we here at Qvault use Go for all of our backend work, and we always commit our vendor folders. Let’s take a look at the reasoning behind my claim …

Read more

Learn Go Fast – Top Courses and Resources

Learn Go Fast; Best Courses and Resources

Want to learn Go fast? We’ve compiled a list of great resources for you, dive in and as always let us know what we’ve missed. What is Go Exactly? The Go programming language, or Golang for short, is an open-source programming language that helps developers build simple, reliable, and efficient software. Go was developed at Google …

Read more