go link package into gopath

This commit is contained in:
Loic Nageleisen 2017-01-19 12:30:23 +01:00
parent c75a2a594a
commit e7eaa93de2

View file

@ -62,4 +62,15 @@ _gopath() {
fi
}
_go-package() {
git remote get-url origin | perl -ne '/@(.*).git/ and { $_ = "$1" and s/:/\// and print }'
}
_link-go-package() {
local pkgn="$(_go-package)"
local src="$(_within-go-project)/src"
mkdir -p "$src/$(dirname $pkgn)"
ln -sf "$PWD" "$src/$pkgn"
}
# vim: ft=sh