Working with Redis

In this post I'm going to be looking at using Redis as a data persistence layer for a Go application. We'll start by explaining a few of the essential concepts, and then build a working web application which highlights some techniques for using Redis in a concurrency-safe way....

Chaos Engineering: A Shift in Mindset

The barbershop problem

The second problem in the “Less classical problems” chapter of the “The Little Book of Semaphores” is called “the barbershop problem”. It as originally proposed by Dijkstra as “the sleeping barber” program. The book presents the pro...

Flag-oriented Programming

booleans, am I right? What a wonderful piece of technology! They help us solve so many problems… I just need this method to behave slightly different when some condition is true. Nice, what’s the problem in that? We had a method like this: class Coffee...

Chaos Engineering 101

Dining savages

In chapter 5 (“Less classical problems”), the “The Little Book of Semaphores”, starts by presenting the “dining saves problem”, introduced by Gregory Andrews in the book “Concurrent Programming: Principles and Practice.” A tribe of...

Quiz yourself in Golang. Part 1

30 basic questions to measure your Golang knowledge. Answers and .go files you can find on GitHub page. Don’t hesitate to create a Pull Request in case of some found errors, typos.

The cigarette smokers

The “The Little Book of Semaphores”, introduces the “cigarette smokers problem”. The problem was originally presented by Suhas Patil in a technical MIT memo¹, as a problem that cannot be solved with semaphores. This is the original formulation: Three smo...

Measure performance changes with benchcmp

go test -bench=. Go has a great option to write your benchmarks and run it together with go test with option -bench. To create a benchmark function you must do the following:

Supported Go types for gomobile bind

gomobile bind With gomobile we can generate language bindings that make it possible to call Go functions from Java. And it’s awesome. Now you can write Android applications in Go (unfortunately without UI features and with pure SDK coverage, but I hope it will grow up from...