Even with Finals literally around the corner I couldn’t help but play around a little with “Google’s New Programming Language” go. In case you haven’t heard about go, you can find out everything you need to know at their simple site http://golang.org/.
I’m not going to talk about what I like/dislike about the language… yet. Instead I’m going to do what everyone else has probably already done. I wrote a simple compiler/link/run shell script which takes its place in my ~/bin:
#!/bin/bash # Author: Joseph Pecoraro # Date: Saturday, November 14, 2009 # Description: Compile, Link, and Run a go script. # Requires a file # Use the proper tools for the arch # Strip .go (if its there) file=`echo $1 | sed -e 's/.go$//'` # Compile, Link, and Run (break on any error) $COMPILER "$file.go" && $LINKER -o $file "$file$EXTENSION" && ./$file
Why did I write my own? The others I had seen were inadequate, didn’t work well with tabbing (filename versus executable name), or didn’t even produce a nice executable name at all. For many, you probably won’t need to compile, link, and run a program all at once (especially in a systems language). However, I’ve found that its a great tool to help me learn the language. This is due in some part to go’s quick compilation and linking.
I tried to make it generic so it could work on any architecture that go currently builds on. I named the script “go!”. Let me know what scripts you’ve built to work with go.