4 ms·
Go for Rubyists
- bsaul 13y agoA 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.
- berto99 13y agoThat 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.
- bsaul 13y agoIndeed, node.js was my other option. But compare deploying another server-side technology to just copy/pasting a binary.
- danaw 13y agoFirst, I'd recommend installing go using homebrew if you're on a Mac using the --cross-compile-all flag. 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 https://coderwall.com/p/pnfwxg
- bsaul 13y agothanks, i didn't know homebrew would facilitate the process. It's always good to know.
- dhaivatpandya 13y agoIf 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.
- bsaul 13y agoBut 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.
- ddd1600 13y ago"fmt" hmm is he going to tell me what "fmt" stands for (bc I'm not gonna look it up right now)? ... Nope, ok then, "foment", I'm going with "foment".
- dhaivatpandya 13y agoOriginal writer here. Let me know if you guys have questions, etc. Was about to post this to HN, then noticed it was already here!