Nicolas314

All my geeky stuff ends up here. Mostly Unix-related

Dance with the Yaks

leave a comment »

YakLet us do something useful tonight: Go 1.0 was just released, why not give it a try?

Finding something called go on Google is of course a tad difficult. The magic URL you want is http://go-lang.org. Good news everyone: they have packages for OSX! Thinking that running it directly from your Mac Desktop would be more comfortable, you download the pkg file and double-click it to install.

Done.

Almost.

Next:

  • Open terminal
  • vim hello.go
  • type in your hello world program

Something is wrong here: no vim syntax highlighting. No way you are going to use a modern editor without syntax highlighting. Ok, this is a new language and vim is probably outdated so update vim.

brew install vim won’t work. Brew tells you that Apple distributes vim with OS X, you can find it in /usr/bin. Ok, that is a very dumb answer. Maybe brew itself is outdated? Try a brew update/upgrade and see if things get better. Nope. Brew complains that your Xcode install is 4.2.1 and you need at least 4.3 to go any further. You already spent a whole evening installing Xcode less than a month ago but now you really want to get the latest and greatest, and you completely trust Apple. What could possibly go wrong?

Sigh. How do you upgrade Xcode? Launching it and browsing through menus does not bring anything. Quick Google search reveals you have to go through the App Store. Let me ponder that cause it bears repeating:

YOU HAVE TO GET THROUGH A FRACKING ANGRY-BIRDIE-SHITTY STORE TO GET A UNIX DEVELOPMENT ENVIRONMENT

Cool down. Click Install, log in with your Apple ID. Now where in hell did you put that ID? Forgot password? Send e-mail, open e-mail, change password, login again — 10 minutes.

Select Xcode in the apps, click Yeah, accept a zillion-page EULA, sign with your blood, and… nothing. Just a grey button saying Installation. At first you do not dare click the only element of user interface you have on screen by fear of unwillingly requesting multiple installations, but after a few minutes nothing moves so you click… but the button stays put. So you click again, and again, and end up on the Apple forums to see if anybody had the same issue.

Oh yeah: Xcode is installing Ok, you just did not notice the snail-paced progress bar in the tiny icon on your (hidden) dock. Judging from the current speed you still have 2-3 hours before Xcode finishes upgrading.

Ok, forget OSX. The damn thing is built around iTunes anyway, trying to do any development on this thing is bound to deliver endless frustrations, no need to loose more time on that topic.

Start up a distant Linux desktop, connect through VNC. Find out that VNC server and your local client have gone out of sync. Update/Upgrade your Linux box (30 packages) and find out that some GPG package keys are obsolete. Spend another couple of minutes trying to fix this, then finally update/upgrade your box. Log in through ssh/VLC.

Start up a web browser to download Go again. Find out that the default web browser likes to start an archive manager once a tgz has been downloaded. That is cool except for one thing: you never used this package manager before so you end up garbling unknown directories and downloading the same file over and over again.

Don’t loose your nerves, you are almost there. Quite.

Time to su, install go to /usr/local. Finally! A quick modification of your PATH and you are ready to explore a new language. Again:

  • vim hello.go

… but still no syntax hilighting. This time hunt for vim syntax support, and find out that go distributes vim config files with the main tarfile. Should have started with that but the later it gets the less you can think clearly. Copy those files to your .vim/ directory and lo and behold: you have your very first syntax-hilighted go hello world in front of you. Cool!

2 hours so far. And Xcode is still merrily downloading away.

Time to run your first go program:


% go run hello.go
Hello, world

Impressive. Now try to compile it:


% go build hello.go
% ./hello
Hello, world

Beautiful! Just curious: how big would this be?


% ls -l hello
-rwxr-xr-x 1271748 Mar 29 22:52 hello*

1.3 megs.

Yeah, you know what? I think I’ll read a book tonight. Old-fashioned dead tree does not require much more than sit and read.

Advertisements

Written by nicolas314

Thursday 29 March 2012 at 11:13 pm

Posted in fun, google, osx, yak shaving

Tagged with , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: