Skip to content

Instantly share code, notes, and snippets.

@daneharrigan
Created February 16, 2012 01:30
Show Gist options
  • Save daneharrigan/1840611 to your computer and use it in GitHub Desktop.
Save daneharrigan/1840611 to your computer and use it in GitHub Desktop.
add a go command to your shell
go()
{
local file_name=${1%.*}
if [ -n "$1" ]; then
__gocompile $file_name
__gorun $@
__gocleanup $file_name
else
echo "The file '$1' does not exist."
fi
}
__gocleanup()
{
rm 6.out
rm "$1.6"
}
__gocompile()
{
6g "$1.go"
6l "$1.6"
}
__gorun()
{
local args=( $@ )
unset args[0]
./6.out ${args[@]}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment