Testing Go HTTP logic with go-httpbin

If you ever found yourself writing a piece of code doing a HTTP POST request and then trying to test it with a real HTTP server, you might have heard of httpbin.org. It offers HTTP endpoints that help you test your client logic, by echoing the headers and other data you sent to it, or by returning a response with the status code you want, among many other things.

Bad thing about httpbin.org is, you don’t really ... Read more →

govvv – Versioning for Go binaries

Go language is getting increasingly popular when it comes to writing microservices and commmand-line tools. It easily lets you compile a complicated application into a single binary, it can cross-compile from any OS to any other OS the Go compiler supports.

Go compiler has this nice LDFLAGS trick to assign values to the variables in the program at the compile time. So if you have a Version variable in your program you can compile it as:

 $ go build -ldflags "-X ...
Read more →

State of Cloud Instance Provisioning

I have been craving to write about this since this is what I have been up to lately at work. I spent quite some time investigating the state of instance provisioning on each cloud provider and I thought I could share these here.

If you are dealing with deploying instances (a.k.a Virtual Machines or VMs) to public cloud (e.g. AWS, Azure), then you might be wondering what your instance goes through before you can start using it ... Read more →

Docker.DotNet is Graduating!

Nearly two years ago I published my side project Docker.DotNet —an open source C#/.NET client library for the Docker Remote API. Ever since, many teams and critical products at Microsoft as well as outside Microsoft started to depend on this library.

I am happy to announce that Docker.DotNet is now an official Microsoft project. Members of the Windows containers team will be the new maintainers of the project. The project will remain open source and it will ... Read more →

Introducing dexec

dexec is a small Go library allowing you to run commands inside Docker containers as if you are running them locally using the os/exec package.

With dexec, you can containerize your external program invocations locally or remotely, using the Docker Engine. Your application will benefit from isolation, security, resource limiting and other advantages of using Docker.

dexec effectively is an abstraction layer that hides the fact that commands are executed within a container, as it gives you the same ... Read more →

Go json.Decoder Considered Harmful

If you are coding with Go and using json.Decoder to deserialize a JSON payload, then you are probably signing up for unexpected outcomes. You should use json.Unmarshal instead.

  1. json.Decoder is designed for JSON streams; not for single JSON objects
  2. json.Decoder silently ignores certain malformed JSON syntax.
  3. json.Decoder does not release network connection for reuse (slows down HTTP requests up to ~4x)

None of this should be a surprise for someone reading the godoc of the ... Read more →