Concurrency In Rust; Can It Stack Up Against Go’s Goroutines?

One of the primary goals of the Go programming language is to make concurrency simpler, faster, and more efficient. With Rust growing in popularity let’s see how its concurrency mechanisms stack up against Go’s. A Refresher On Goroutines In Go, concurrency is accomplished by spawning new goroutines: In the example above, we use the go … Read more Concurrency In Rust; Can It Stack Up Against Go’s Goroutines?

Rust vs Go – Which Is More Popular?

Go and Rust are two of the hottest compiled programming languages. I develop in Go full-time and love it, and I’m learning more about Rust recently – its an exciting language. Let’s explore some differences between the two and look at which is growing faster in the popularity polls. Popularity Stats According to the StackOverflow … Read more Rust vs Go – Which Is More Popular?

Range Over Ticker In Go With Immediate First Tick

The Go standard library has a really cool type – Ticker. Tickers are used when you want to do something at a regular interval, similar to JavaScript’s setInterval. Here’s an example: As per the docs, a ticker is a struct that holds a receive-only channel of time.Time objects. In the example at the beginning of … Read more Range Over Ticker In Go With Immediate First Tick

Connecting To RabbitMQ In Golang

RabbitMQ is a message broker that’s great for pub-sub systems in a micro-services architecture. At my current day job, we use RabbitMQ in our data ingest pipeline. All the services are written in Go, and they all push data through hundreds of RabbitMQ queues. Let’s take a look at how to efficiently publish and subscribe … Read more Connecting To RabbitMQ In Golang

Using ‘Go Generate’ To Deploy Multi-Process Apps

In microservice architectures, it is 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 great tool that can be used as well, go generate. Here are some examples of how we take advantage of ‘go … Read more Using ‘Go Generate’ To Deploy Multi-Process Apps

Use Anonymous Structs For JSON Marshalling in Go

Go is a language built for the web. The Go standard library comes with everything we need to stand up a production web server. Today we are going to explore marshaling JSON using anonymous structs. Anonymous structs can help keep API handlers clean and simple. What Is A Struct? Go’s structs are typed collections of fields. They’re … Read more Use Anonymous Structs For JSON Marshalling in Go

Announcing Go-TinyTime, Go-TinyDate’s Sister Package

time.Time is the perfect choice for most cases, it even comes in the standard library! The problem is that the time.Time{} struct uses more than 24 bytes of memory under most conditions. Go-TinyTime solves this problem by restricting the available dates to the range between 1970 – 2106, and only supporting UTC timezones. This brings … Read more Announcing Go-TinyTime, Go-TinyDate’s Sister Package

Golang Conversions – Ints To Strings And Strong Typing

Go is a strongly typed language, which means at any point a developer should know exactly what type of value they are dealing with. For example, if we have a function that prints a string, we can’t just give it an integer and expect it to work. We have to cast it to a string … Read more Golang Conversions – Ints To Strings And Strong Typing

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