Skip to content

Instantly share code, notes, and snippets.

@motemen motemen/gorun.sh
Created Mar 9, 2018

Embed
What would you like to do?
Shell script to run a Go program by package path
#!/bin/bash
set -e
pkg="$1"; shift
files=($(go list -f '{{range .GoFiles}}{{$.Dir}}/{{.}}{{end}}' "$pkg"))
go run -exec "bash -c 'shift; exec \"\$0\" \"\$@\"'" "${files[@]}" -- "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.