Topics include: programming, Apple, Unix, gadgets, large-scale web sites and other nerdy stuff.

Notes on the Go Language

2015-06-08 10:00

I'm playing with the new language Go. I got interested in it after playing with Swift. I really like the idea of a compiled language that has modern syntax and capabilities. I was messing around with scripts and server apps on my Mac. But these experiments had a hard limit: if I ever wanted to do something "real" with a server/web application, Swift is not a viable option. I can't run it on a virtual private server.

Sure, I could scale up a Mac Mini Colo installation, but that is very limiting: there's one and only one hardware and OS vendor to support me and that vendor has a much greater than 0% percent chance of changing something core in the OS that could really break a server app. Apple's target market is end-user consumers, not nerdy developers who want to implement a large-scale web app on a few dozen (or even hundred) Macs.

I started looking at go as an alternative. Go has a similar flavor to Swift: it's modern, compiled, fast and it is open source. I know it is really a creation of Google, but it is cross-platform. If Google abandons it (much greater than 0% chance, I'm sure), there probably is enough critical mass outside of Google to keep it going. At the very least, there is the source code and specification.

I like the idea of a server app being composed of a single language, as least as far as that is practical. It makes moving code and people around a system a lot easier, and you don't get into a situation where, for example, the image server is written in Haskell and the original person who wrote it left the company, and no one wants to touch it. Pick a primary language and use it everywhere you can. If you must write some administrative scripts in Perl or something, fine. But, please, only if you must. (And use Perl for all of them, don't do some things in Perl and some in Ruby and some is Python. Pick one.)

So here are some random notes as I explore Go.

[I paused writing this article to go to lunch and then watch the WWDC 2015 Keynote. Where they announced that Swift 2 will be open source. Which is great, and of course might mean I could use swift as a language for Web apps. However, that is probably at least a year away, and Apple has to pull off doing a real open source effort, not a Sun/Oracle/Java situation.]

Back to Go, for now though.

Debugger: debug supprot on Go seems pretty weak. There are apparently gcc-based implementations of Go, and gdb sort-of works with them. I did find one project on Github that wants to be a complete native debugger for Go Delve

Databases: seems like there is a support for SQL drivers, including MySQL and Postgres.

Frameworks: There are at least a few frameworks under development. Revel looks like it is pretty far along, but it is not yet a 1.0. The documentation is internally inconsistent, for example. Stuff is still changing pretty fast. Another one, Beego looks a lot farther along.

There is a Go SDK for AWS provided by Amazon.

There is a Go plugin for JetBrain's IntelliJ. It's an Alpha.

There is a markdown implementation: blackfriday