Cross compilation just got better in Go 1.5
dave.cheney.net
dave.cheney.net
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.
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).
No snark intended, I say this unironically as someone who uses Go regularly, even for new projects.
I wouldn't pick it for code golf or a programming competitions, but as someone who's been programming for a long time and haa come to value the ability to make clean, simple code that doesn't break (eslecially in weird ways at bad times), I really enjoy Go and think it actually is a really good, if in certain respects unambitious, language.
Go, to me, feels like it has some of the expressiveness and discoverability of python, with the added bonus of type safety and raw performance of C (for my purposes, at least). For most of my small projects, it fits a nice niche. Any time I need a lightweight HTTP/JSON API to talk with a fancy javascript frontend, Go is slowly becoming my tool of choice -- especially if it may end up on other platforms (including Windows).
When I wanted to learn Go I set aside a Saturday to grok the docs and "getting started" guide, and was surprised to find I finished by 10am (including a coffee break). The language itself is very small, and I found myself successfully "guessing" at structs and function signatures very early.
It's at least worth exploring, especially given the tooling for web, opengl, and android.
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.
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, ...
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.
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
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)
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).
Is weird is not more popular (not just Delphi/pascal, but the idea of easy copy/paste deployment)...
Having a kind of packaging for shipping is more or less popular now...
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
(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").
Did they ever figure out dependency versioning?
(a) vendoring with something like godep[1], or (b) point in time scm fetching with something like gpm[2].