Parse environment variables to structs in Go

In Go, it’s dead simple to get the value from an environment variable: fmt.Println(os.Getenv("HOME")) But, sometimes you have default values… so you would have to do something like this: home := os.Getenv("HOME") if home == "" { home = "TH...

Organising Database Access in Go

A few weeks ago someone created a thread on Reddit asking: In the context of a web application what would you consider a Go best practice for accessing the database in (HTTP or other) handlers? The replies it got were a genuinely interesting mix. Some people advised usin...

Cheap MapReduce in Go

Here at Malwarebytes we have to deal with a huge amount of data generated by many different systems, malware research teams, telemetry, etc. That data can span for several Terabytes on a daily basis. We have been using Amazon’s Elastic MapReduce (EMR) in many different occ...

Singleton Pattern in Go

The Go Language growth has been phenomenal in the last few years, and is attracting language converts from all walks of life. There has been a lot articles recently about companies switching from Ruby, and experiencing the new world of Go and it’s parallel and concurrent ap...

Small Go Apps Containers

Or: how to ship your app in a <20Mb container. Well, as you may know, there is a good amount of people now building microservices in Go and deploying them as Docker containers. I do not yet have a lot of experience with Go and Docker, but I’ll try to share what I learned...

Supercharging the Atom Editor for Go Development

After years of using Integrated Development Environments (IDE) during my Windows progamming days, such as Visual Basic IDE, Borland Delphi IDE, Visual C++ and more recent Visual Studio, I have ditched all of those when I switched to Mac OS X about 10 years ago. My initial transi...

Calculating Multiple File Hashes in a Single Pass

We do a lot of file hash calculations at work, where we commonly go through millions of files a day using a diverse number of hashing algorithms. The standard Go library is amazing, and it has many structures and methods to do all that kind of stuff. Sometimes you just have to lo...

Handling 1 Million Requests per Minute with Go

Here at Malwarebytes we are experiencing phenomenal growth, and since I have joined the company over 1 year ago in the Silicon Valley, one my main responsibilities has been to architect and develop several systems to power a fast-growing security company and all the needed infras...

My First Post

For years I have been thinking about creating a spot where I can post articles about programming and technology in general. But every attempt to do so have result in complete failure, mostly due to the hassle of setting up maintaining a blog that can be easily updated. I’ve...

Avoid static imports

There are a lot of Java API’s and Frameworks which rely in static methods and the sort. Arguably, this is a bad OOP practice, but lets not enter this particular subject just yet. For example, it is pretty common to write unit tests like this: package blah; import static org...