7 ms·
Cross compilation just got better in Go 1.5
- bsaul 12y agoI'm really looking forward to see more tools ported to go. The simplicity of copy/paste deployment is really something you don't realize until you've experienced it. Now, the simple idea of installing python and dependencies then doing pip install for wal-e installation, made me search for an hour on git in hope for a standalone golang binary.
- mamcx 12y agoThat is the same experience with Delphi. Is weird is not more popular (not just Delphi/pascal, but the idea of easy copy/paste deployment)...
- mbell 12y agoIt's quite common in the Java world to build a 'fat jar' which is the same idea, all dependencies other than the JVM itself in a single file.
- girvo 12y agoOne could make an argument that with PHP, copy-paste deployment is popular. Of course, it's not quite the same thing, as you'll need Apache/etc. setup, however that is one of PHP's strengths. It's good to see another language doing something similar, but in a nicer, far more performant way: specifically for web development, the way Go does stuff is brilliant in my opinion.
- pjmlp 12y agoIt is pretty common on Windows and Mac OS X worlds, but it seems not so in GNU/Linux.
- bkeroack 12y agoIn theory it's also true of ASP.NET. You have a magic folder of CLR-compiled binaries you drop into the IIS site root folder and it "just works" (or doesn't, as the case may be).
- mamcx 12y agoAh, I was not clear. I mean copy/paste without the need of a runtime. With Delphi (go?) you just ship the exe (and can even put inside it the resources). Having a kind of packaging for shipping is more or less popular now...
- rtpg 12y agoHow well does this work in practice? I mean for a web server don't you still have to hook up _something_ in the server (at least to start up the binary)? I mean in _theory_ setting up a Django webserver is just a ./manage.py runsrever but in practice there's a lot of stuff to fix up
- TylerE 12y agoJust use something like supervisord: http://supervisord.org/ http://supervisord.org/ Super easy to setup - way easier than manually writing init scripts - and it'll handle things like auto-restarting the process if it dies (if you want it to). It also supports dependency chaining (e.g. before starting the web service, start the DB)
- wtf_is_up 12y agoYeah. I use systemd if the target env already has it, otherwise supervisord does a fine job.
- rebelnz 12y agoI concur - just set up a couple of sites (written in go) and use Supervisor - its a nice tool and pretty intuitive. Using conf file to specify run app as particular user, set environment variables, logs, autostart etc.. - good to have in one place.
- bsaul 12y agoGo includes a really good http lib that you can use to handle incoming http connexions. So really, my whole deployment for now is one apt-get for postrges, a golang binary and one json file for configuration, period. For the service itself i wrote a basic init.d file, but i'll probably use something better ( i see supervisor mentionned, i'll try that).
- domrdy 12y agoIf your site does not have a single static or template file, this is true. I agree that the binary is nice but scping it to the server and calling it a day still doesn't work.
- icebraining 12y agoActually... https://github.com/jteeuwen/go-bindata https://github.com/jteeuwen/go-bindata
- fortytw2 12y agoNot to forget - https://github.com/rakyll/statik https://github.com/rakyll/statik and https://github.com/GeertJohan/go.rice https://github.com/GeertJohan/go.rice among many others
- mholt 12y agoThis is awesome. Back in the day, writing cross-platform code meant knowing the ins-and-outs of each platform you wanted to support and coding specifically for each one. Interpreted languages (like Python) and runtimes (like JRE) take a lot of the pain away, but that means all those programs have a dependency: the interpreter or runtime. Go isn't interpreted and bundles its runtime inside the executable. That has always been pretty great, but with Go 1.5, the programmer won't even have to run `env GOOS=... GOARCH=... make.bash --no-clean` before compiling for another platform. With veteran OS and systems engineers working on the language, this is why we can have nice things.
- pjmlp 12y ago> Back in the day, writing cross-platform code meant knowing the ins-and-outs of each platform you wanted to support and coding specifically for each one. If you mean C and C++ POSIX behavior, yes. If you mean native languages with rich runtimes like Ada and Modula-2, not really. Finally Go doesn't get rid of OS specific stuff like pathnames, security, ...
- samuell 12y agoAwesome stuff! :) In case someone wants to try out this cleanly in a docker or virtualbox without breaking their host machine's golang install, it is now available as a commented-out ansible role in the vagrant box I created over the weekend: https://github.com/samuell/golang-vagrant-ansible https://github.com/samuell/golang-vagrant-ansible (Instructions for enabling the Go 1.5 role in the repo README ... but in short, just uncomment "- golang-1.5" in playbook.yml, and comment out "- golang" instead, before running "vagrant up docker" or "vagrant up virtualbox").
- frikk 12y agoI had a recent project that I built with go 1.3. It was a small project ( < 4 weeks ) but it had some interesting requirements -- my app had to be deployed to ARM (raspi), and on an OSX laptop for control, and I use a linux laptop. The cool part was that it "just worked". GOARCH=arm go build myapp.go GOOS=darwin go build myapp.go go build myapp.go All three "just worked" with absolutely no surprises, including use of the http engine, json, and a third party serial port library. The native binaries run like a champ. Looking forward to the continued evolution of golang.
- yoklov 12y ago> All three "just worked" with absolutely no surprises Jeez. That's pretty incredible. As someone who absolutely hates dealing with build configuration it's almost tempting enough to take a closer look at go, despite the fact it's garbage collected and I'd never be able to use it (or, if we're being completely honest, want to).
- LBarret 12y agoGo tooling is excellent. Above anything else IMHO. Sadly the language itself is not so good.
- nothrabannosir 12y agoThis is completely true. "Everything about Go is amazing, except the language." No snark intended, I say this unironically as someone who uses Go regularly, even for new projects.
- vezzy-fnord 12y agoUnsurprisingly they've taken the Plan 9 approach, sardonically contrasted with the GNU one here: http://aiju.de/rant/cross-compiling http://aiju.de/rant/cross-compiling
- TylerE 12y agoI've been away from go for a long while. Did they ever figure out dependency versioning?
- stock_toaster 12y agoI don't believe so. Your options are still pretty much: (a) vendoring with something like godep[1], or (b) point in time scm fetching with something like gpm[2]. [1]: https://github.com/tools/godep https://github.com/tools/godep [2]: https://github.com/pote/gpm https://github.com/pote/gpm
- hooluupog 12y agohttps://groups.google.com/forum/#!topic/golang-dev/nMWoEAG55v8%5B1-25%5D https://groups.google.com/forum/#!topic/golang-dev/nMWoEAG55...
- cyri 12y agoThey've started to think about it: https://groups.google.com/forum/#!topic/golang-dev/nMWoEAG55v8 https://groups.google.com/forum/#!topic/golang-dev/nMWoEAG55...
- giovannibajo1 12y agoDoes it work if I first compile for GOARM=5 and then for GOARM=7 (or vice versa)?
- MereInterest 12y agoI haven't checked in a while. Does cross-compiling now support libraries that are implemented in C? As this includes some of the standard library, this seems like a rather large stumbling block.