Golang: battling raceconditions with mutexes

Now that I’ve glanced over some of the concurrency basics, one big problem arises that kills our application under seemingly very obscure circumstances. So called “raceconditions” will break everything you love once things start to warm-up scale wise. Your code is suddenly exposed to multiple workers trying to read from/write to the same source. Causing … [Read more…]

Golang bits and pieces: Concurrency

So called “goroutines” allow you to structure your code for multithreading, however this doesn’t directly imply your goroutines run in parallel. Consider goroutines more of a strategy to optimize and logically put together your code so that its ready to handle multiple things at once independently. Goroutines can created by prepending a function call of … [Read more…]

Golang bits and pieces: IO with readers and writers

Readers and Writers, they’re everywhere. But how do they work and how do I use them? I had some trouble getting familiar with their usage, but in reality it’s really simple. Reader, Writer, ReaderWriter and ReaderWriterCloser are interfaces, interfaces that simply implement Read, Write, Close or any combination. They all take a simple byte slice … [Read more…]