How To Separate Library Packages in Go

I’ve often seen, and have been responsible for, throwing code into packages without much thought. I’ve quickly drawn a line in the sand and started putting code into different folders (which in Go are different packages by definition) just for the sake of findability. What is a Package? In Go, code is organized into packages. … Read more How To Separate Library Packages in Go

I Wrote Go-TinyDate, The Missing Golang Date Package

time.Time makes dealing with dates and times in Go a breeze, and it even comes bundled in the standard library! However, a time.Time{} struct uses more than 24 bytes of memory under most conditions, and I’ve run into situations where I need to store millions of them in memory, but all I really needed was … Read more I Wrote Go-TinyDate, The Missing Golang Date Package

Golang Mutexes – What Is RWMutex For?

Golang is King when it comes to concurrency. No other language has so many tools right out-of-the-box, and one of those tools is the standard library’s sync.Mutex{}. What Problem Do Mutexes Solve? We don’t want multiple threads accessing the same memory at the same time. In concurrent programming, we have many different threads (or in … Read more Golang Mutexes – What Is RWMutex For?

Best Practices For Writing Clean Interfaces in Go

Interfaces allow us to treat different types as the same type when it comes to specific behaviors. They are central to a Go programmers toolbelt and are often used improperly by new Go developers… leading to hard to read and buggy code. Recap on Interfaces Let’s look to the standard library as an example of … Read more Best Practices For Writing Clean Interfaces in Go

Wrapping Errors in Go – How to Handle Nested Errors

By Lane Wagner @wagslane on Twitter The paradigm of errors as a type, rather than something to be thrown and cause panics, allows for more control of how to handle “bad” state. It also forces developers to think about errors at every step. What will go wrong here? How should I handle it? There are … Read more Wrapping Errors in Go – How to Handle Nested Errors

How To Build JWT’s in Go (Golang)

By Lane Wagner ā€“ @wagslane on Twitter Go is becoming very popular for backend web development, and JWT’s are one of the most popular ways to handle authentication on API requests. In this article, we are going to go over the basics of JWT’s and how to implement a secure authentication strategy in Go! What is a … Read more How To Build JWT’s in Go (Golang)

Why is Exclusive Or (XOR) Important in Cryptography?

If you are getting into cryptography, or just trying to understand the fundamentals, you may have noticed that the exclusive-or operation is used quite often, especially in ciphers. What is XOR (āŠ•)? XOR, or “exclusive or” operates on binary data. It returns true if both of its inputs are opposites (one false and one true), … Read more Why is Exclusive Or (XOR) Important in Cryptography?

BitBanged SPI in Go, An Explanation

Iā€™m going to focus mostly on some design decisions and also how I went about writing an SPI interface using Go on a Raspberry Pi. I assume my readers have a basic understanding of what a Raspberry Pi is, and how basic electronics work. If not, read on anyway and I will be sure to … Read more BitBanged SPI in Go, An Explanation

Qvault’s Lead Engineer Interviewed on “Running in Production”

Check out the following podcast: https://runninginproduction.com/podcast/6-qvault-is-an-open-source-tool-to-manage-passwords-and-crypto-keys Before I begin, I must give thanks to Nick for having me on the show! In this episode of Running in Production, I talk with Nick about how we built Qvault, an open-source password manager that specializes in cryptocurrency. Qvault uses Electron and has a Serverless component that uses Golang. … Read more Qvault’s Lead Engineer Interviewed on “Running in Production”

Building a Music/Video Streaming Server in Go – Using HLS

In this tutorial, I’m going to walk you through building a streaming API using Golang. Don’t worry, its surprisingly easy to build a robust streaming server, especially if we utilize one of the more modern protocols: HLS. What is HLS? HTTP Live Streaming is an HTTP-Based adaptive bitrate streaming communications protocol developed by Apple. https://en.wikipedia.org/wiki/HTTP_Live_Streaming … Read more Building a Music/Video Streaming Server in Go – Using HLS