Last active
February 23, 2018 23:32
-
-
Save mkmik/744ab3244f974715d805e25e150fb7eb to your computer and use it in GitHub Desktop.
workaround for https://github.com/sqs/goreturns/issues/43
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 -euo pipefail | |
# go-vim checks for flags like srcdir | |
echo -- "$@" | grep -- --help && exec goreturns "$@" | |
tmp_dir="$(mktemp -d)" | |
cleanup() { | |
rm -rf "${tmp_dir}" | |
} | |
trap cleanup EXIT | |
our_tmp="${tmp_dir}"/file.go | |
args=("$@") | |
vim_tmp=${args[${#args[@]}-1]} | |
args[${#args[@]}-1]="${our_tmp}" | |
cp "${vim_tmp}" "${our_tmp}" | |
$(dirname "$0")/goreturns "${args[@]}" 2>/tmp/err | |
cp "${our_tmp}" "${vim_tmp}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment