Scripting the Go-compiler

November 17, 2009

A good programmer is a lazy one, the cliche says. Maybe. An easily distracted one if nothing else. While trying out Google’s newly released compiled language Go, it bothered me that there was not a faster way to compile, link and execute the little programs I was writing. So, rather than to teach myself something actually useful i wrote a script to do this all at once.

It is invoked by goc (best move it to /usr/bin first), the file to compile and then the arguments to give the program when it executes.

The -s flag will try and mute all compile and linking errors and the -m flag will rename the executable to whatever your .go file’s name was.

You can download it here. Sourcecode after the jump.

Read the rest of this entry »