Projects

First published: May 12, 2014, 3:00pm -0700
Last edited: May 12, 2014, 3:00pm -0700

Space Monkey Go libraries

This article was originally posted on Space Monkey’s blog as “Go Open Source”.

Recently we wrote about how we transliterated a large Python codebase to Go. In doing so we ended up porting or writing some useful things we had already written in Python or Python already had. We’ve also written some useful tools for understanding and debugging Go. We’ve decided to open source these Go libraries and give them back to the community as a way of saying thanks.

OpenSSL Bindings

Go has an excellent, albeit young, builtin TLS library in its standard library. However, there are a few critical complications with its young age.

At Space Monkey, we needed the hardware acceleration, certificate validation customization, and didn’t want timing attacks. So we wrapped OpenSSL and got significant speed improvements over Go TLS.

Then the internet found out about the “heartbleed” bug.

We’re still betting on OpenSSL. Heartbleed was a nasty bug, but it and the subsequent bugs found are now fixed, and the OpenSSL project is stronger than ever.

You can find out more here:

Error library

Go errors are simplistic at best. While we in no way are interested in capturing Python’s exception throwing semantics in Go, we did miss getting stack traces of error creation sites, exception hierarchies, and a few other things. Our hierarchical error library mimics many of the features we used exceptions for in Python, while remaining idiomatic Go.

Logging

Python had leveled and hierarchical logging. While the glog package provides the levels, it doesn’t match the abilities we had in Python to set up different logging handlers per package. So, we wrote a flexible leveled logging library that easily supports structured and unstructured output targets based on configurable named loggers.

Monitoring

Our Python codebase had many function calls instrumented to collect and report timing data using a system that provided function decorators. This is what we came up with for Go.

Flagfile

We open sourced this a while ago, but we’ve submitted significant changes to the package since our original release. This library extends Go’s flag library to include working with flagfiles, as gflags does, in addition to some other small extensions. It was extended to support config files written using a subset of Python’s ConfigParser syntax.

What’s next

We got lots of requests for releasing some of our Python projects as well; we anticipate open sourcing more things, but these are what we have ready to go for now.

Happy hacking!

Want to work on Go?

We’re a small team based in Salt Lake City, and we’re looking for Go developers! Drop us a line.