-
-
Save athomason/e1f4cdd228c6d63dc896c706538aaa76 to your computer and use it in GitHub Desktop.
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 | |
t1=`tempfile` | |
t2=`tempfile` | |
trap "rm -f $t1.go $t2.go $t2" EXIT | |
echo "package main; func main() { $@; }" > $t1.go | |
goimports $t1.go > $t2.go | |
if [[ $? != 0 ]]; then | |
echo "goimports failed:" | |
cat $t1.go | |
exit | |
fi | |
go run $t2.go | |
if [[ $? != 0 ]]; then | |
echo "go run failed:" | |
cat $t2.go | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment