Skip to content

Instantly share code, notes, and snippets.

@rkulla
Last active August 23, 2016 04:16
Show Gist options
  • Save rkulla/bbe82f81fa1baa283a5fde2aec8fb5a9 to your computer and use it in GitHub Desktop.
Save rkulla/bbe82f81fa1baa283a5fde2aec8fb5a9 to your computer and use it in GitHub Desktop.
go wrapper to "go run" implicitly when you type "go *.go"
#!/bin/bash
# Simple go wrapper for typing "go file.go" instead of "go run file.go"
# Allows flags and wildcards as usual.
#
# Installation: Copy this wrapper to first in PATH, e.g. $GOPATH/bin
realgo=/usr/local/go/bin/go
if (( $# > 0 )) && [[ "$1" = *.go ]]; then
$realgo run "$@"
else
$realgo "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment