One of the nice features of golang is that you can simply distribute
your programs through executables, meaning the user doesn’t need to
have custom libraries to install / run your software: just download the
executable and you’re set.

What Go really does is to bundle together all your *.go files in a single,
platform-dependent executable, that
can be run with a single click — which works perfectly in 99% of our use cases.

All of this seems great, until you have to bundle different kind of files
in your application, for example an .yml config file or an .xliff
translation file.

How would you approach this? Enter the trick of the year.

The idea

The idea is that you can create a go source file which contains all of the
non-go files you need to bundle, something of this sort:

I wrapped all of this together in a github repo,
where you can see the asset
and how it can be included in go code with go-bindata:
this is something I had to do in one of my libraries, touchy,
and that I automated through a Makefile
(no go-generate for me, too lazy :)).

PS: on a side note, have you heard of nexe?
It’s a compiling tool for node, which seems to alleviate the pain of distributing node executables.