I know I ranted and raved (mostly ranted) about how awesome Dart is (and it is), but I finally decided to bite the bullet and learn Go. I’ve seen it around for some time now, and it always looked far too strange to me to wrap my head around. Until I decided to BRO DOWN AND CRUSH CODE with it. (I kid).
The Idiots Guide (plot twist… I’m the idiot)
So what Go is. It’s like if C and Python had a baby. A statically typed systems programming language with no external dependencies. The binaries are built to be a self-contained runtime with no dynamic linking involved. “But, static linking, the binaries will be HUGE!!!!?!?” yeah and so are our hard drives. This isn’t the era of “64K should be enough for anyone!”
Libraries are simple to “go get” (part of the go command line utilities), this initializes the build scripts to go and search out the libraries you’ve imported in your project, and fetch them via git, mercurial, or subversion (likely more but I typically only have ever imported libraries from github). Go downloads them into your folder structure (the GOPATH) where all the libraries and projects you use and work on live. This is pretty awesome all things considered, one string, such as… import "github.com/term1nal/randstr" … will take care of downloading the library and opening a reference to it for use in your code! Pair that with Sublimetext 3 and the Go plugin package to give you some nice auto complete, auto formatting, and linter warnings built right into the editor, for a super friendly Go development experience!
Go doesn’t do threading in the same fashion as you’d expect, instead, it has a really neat concurrency model that I’m nowhere near smart enough to tell you anything useful about it other than it’s pretty much the easiest concurrency pattern I’ve ever had the pleasure of working with. It’s a simple keyword go that splits off a “goroutine” that runs concurrent. You can pass data back and forth between it with a thing called a channel. A channel is basically a blocking FIFO buffer of data that takes care of all the synchronization. They’re dead simple to use, take a bit of thought to understand, but once you do, they’re just ever so nifty.
Speed? Keanu Reeves eat your heart out…
Go is fast! Though, from all of the stuff I’ve read (I haven’t gotten much into it myself, yet..) Go code can be written in such a way that it detracts from the performance and causes go to run a slow as things like Python, Ruby, or Java. But with some minor tweaking and tuning, Go and get down near to the speed of C. It has all sorts of wonderful built in profiling and benchmarking tools to aid this effort. The philosophy of it seems to write it quick and get it working, then tune it to be as fast as it possibly can.
PUT IT IN MY FACE HOLE!!
Here’s some cool talks and resources to check out if you’re interested in Go:
Concurrency is not Parallelism from the creator himself!
What about you?!
I recently updated my projects page, you can take a look at the new section on some of my starting golang projects I’ve started/have been involved with so far!
Thanks as always for spending your valuable time reading my swill, feel free to send your hate or love down in the comments I do (eventually) read them!!!