Created
March 9, 2018 05:17
-
-
Save motemen/5b2ecf1d24621ef0ca4c45abadf50e46 to your computer and use it in GitHub Desktop.
Shell script to run a Go program by package path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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