.gopath superpowers

This commit is contained in:
Loic 2017-01-19 10:57:45 +01:00
parent 044c21c7e2
commit e6db52d09a

View file

@ -7,8 +7,16 @@ _within-go-project() {
local next_check_dir=${check_dir%/*} local next_check_dir=${check_dir%/*}
while [ "$next_check_dir" != "" ]; do while [ "$next_check_dir" != "" ]; do
if [ -f "$check_dir/.gopath" ]; then if [ -d "$check_dir/.gopath" ]; then
echo "$check_dir/.gopath"
return
elif [ -f "$check_dir/.gopath" ]; then
local gopath="$(cat "$check_dir/.gopath")"
if [ -z "$gopath" ]; then
echo "$check_dir" echo "$check_dir"
else
echo "$gopath"
fi
return return
fi fi