Loading
0 comments

Going Go on Windows

 

I admit it: I love all things Google. Gmail, Google+, Google Music, Google Docs, AppEngine, Apps for Domains, AdSense, Analytics -- I use and enjoy them all. I was very excited when I first saw the announcement about Google’s new programming language Go, but I didn’t set about learning it right away. I was deterred not having any particular project build with it, and it was not available for Windows, my platform of choice.

The first problem was solved by the addition of the Go runtime to the AppEngine platform. It was a perfect fit for a project that I had been working on with the idea of deploying it on node.js. I still think that I might build a backend for this program in Node, not only to have a backup to AppEngine but also to learn Node really well. The second problem has mostly been solved by the release of the official SDK for Windows. After downloading and installing it, I was immediately about to compile and link, but using other tools like gomake and gotest was not working. Through a great deal of trial-and-error, I eventually settled on a solution that now works very nicely for me.

The biggest hurdle to overcome is that many of the Go tools assume the existence of the standard UNIX developer toolchain, such as make. There are many packages that offer ports for UNIX: Cygwin, GnuWin32, Djgpp, Microsoft’s Windows Services for UNIX and MinGW just off the top of my head. I tried all of them and eventually settled on the MSYS package from MinGW. While it doesn’t contain an entire development environment, it has bash, make and a terminal window (rxvt) that is a vast improvement over the stock DOS command window.

After installing MSYS, you want to make some config changes to make things easier for you. In etc/fstab, you can map your long and complicated Windows paths to directories in your MSYS home directory. For instance, I like to map C:/Users/adam/Documents/Projects to /home/Adam/projects, so when I start up the MSYS shell, I can just cd projects and I will be were all my code lives. Also, you may want to modify the .bash_profile in your MSYS home directory such that it creates and exports the Go-related environment variables that will make the Go tools work correctly.

Once you have all that set up, you should be able to start up the MSYS terminal, cd to the directory where your Go project lives and use gomake and gotest to compile, link, install and run unit tests.

I have been having a great time learning Go. It is a wonderful language, and I really hope that it gains traction. I will be having a lot more blog posts in the near future about it and some of the work that I am doing with it. I already have an open source Go project hosted on bitbucket: mtemplate.
0 comments

AppEngine/Go Knowledge Resources

I have been spending a great many evenings working on a web application that will -- some day -- run on AppEngine's Go runtime. Go is a wonderful language, and programming with it is fun in a way that is increasingly uncommon. Still, it is a very new language and good references are rare. Useful documentation for the AppEngine/Go platform is even hard to come by; the so-called "Reference" for the Go interface to the datastore is little more than a few simple examples and a trivial list of API calls. It's disappointing, frustrating and unproductive.

Fortunately, the web is full of smart people who are willing to go out of their ways to share what they have learned, and I am gradually discovering all of them. I will be listing them here for my own reference as well as making the discovery process less difficult for my fellows.

Ugorji Nwoke's Blog is full of great ideas and thoughts about AppEngine/Go and AppEngine as a platform generally. Very smart, interesting guy.

Miek Gieben's Learning Go isn't specifically about AppEngine, but it is an invaluable reference for the GO language.

GoLang Tutorials has some very valuable guides for obtaining a better mastery of Go. If you find yourself feeling a bit confused by something that Go does a little differently than other programming languages (like interfaces) you may well find a well-written and informative post here that will clear the way for you.

 

So, it is a meager collection at the moment, but I will be adding to it every chance that I get. Also, I hope to be making my own blog a useful resource, as I have a couple of good techniques and ideas that I have come up with while working on my project.