Using POSIX sed for infile substitution

Something I learned when I started writing tools for developers in companies is that there’s GNU sed, BSD sed and that they are not compatible for something that I tend to write a lot: infile substitution. I would find myself doing conditionals, finding out if it was running in a Darwin/BSD or if it was running on Linux. Then there was the bit where some people would install gnu-sed from Homebrew in their macs and add the gnubin path to their $PATH which then would break my conditionals because they would be using GNU sed in which I thought were BSD sed.

Copying Pointers in Go

Over a year ago I was trying to make a copy of a *url.URL and ended up with this quite nasty way to do so. I even applied this to maskpass, a small package that masks the password of an url.URL to make it log-friendly. But today, looking for a nice clean way to do so in a PR being sent to Go I realized tmp := *src does the work nicely.

Using multi-stage Dockerfile for small Go docker images

This post will show you how to write a multi-stage Dockerfile and end up with a very small Docker image with just your application binary. One of the very interesting things of using a compiled programming language like Go is that you end up with tiny binaries, which then you can distribute as such. If combined with Docker you can end up with very tiny images that are faster and cheaper to distribute.

Git Init

So, this is the initial post for this weblog. The mission is to share technical things I’ve learned doing stuff, right now the focus is Go, Docker and bash, but it’s not a hard limit on what will be written here.