A bit of a sidenote, but i had yet another (failed) attempt at starting a real go project :
I very recently wondered whether i wouldn't implement a very simple Server Side Event service in golang. My stack is python, and i didn't want to install yet another series of tech (gevent, gunicorn, etc..) for dealing with non-blocking services on the server side, as my server configuration already has way too many dependencies for my taste.
So, I thought, hey why not create a very simple binary in go. I would simply download the compiler, code 50 lines using a couple of libs, compile and deploy. Boom. done.
Well, as it turns out, my dev environment is Mac, and my production is running on the cloud, in an Ubuntu environment. So i realized that i would need to compile my code for every hardware target i plan to deploy my code on. That means, download the compiler from source, and use cross-platform compilation options. I know, it kind of goes with having a single binary.
It probably would have taken me 2 hours max to figure things out, but going back to hardware consideration really felt a bit weird and kind of tamed my enthusiasm of the moment. So, i simply postponed that project, swearing to myself I would take the time to look into it some day.
That sounds like a problem that could be solved in nodejs pretty easily. I also want to get going with Go but just don't have any pressing need for it right now.
If I understand your problem correctly, you can just build on the server, right? That's one of my quibbles with Go; the "write-compile-run" cycle gets annoying. But, for me, the benefits outweigh the harms.
But that means installing the whole sdk plus my code on the production server. Since it's a cloud environment, and i want to be able to deploy on various cloud, i would need to include go compiler source into my (already too big) deployment process.
That's precisely the thing i wanted to avoid in the first place.
9 comments
[ 4.1 ms ] story [ 30.6 ms ] threadSo, I thought, hey why not create a very simple binary in go. I would simply download the compiler, code 50 lines using a couple of libs, compile and deploy. Boom. done.
Well, as it turns out, my dev environment is Mac, and my production is running on the cloud, in an Ubuntu environment. So i realized that i would need to compile my code for every hardware target i plan to deploy my code on. That means, download the compiler from source, and use cross-platform compilation options. I know, it kind of goes with having a single binary.
It probably would have taken me 2 hours max to figure things out, but going back to hardware consideration really felt a bit weird and kind of tamed my enthusiasm of the moment. So, i simply postponed that project, swearing to myself I would take the time to look into it some day.
After that you can compile a binary for any supported architecture without much work:
GOOS=linux GOARCH=arm go build file.go
See: https://coderwall.com/p/pnfwxg
That's precisely the thing i wanted to avoid in the first place.