Skip to content

Instantly share code, notes, and snippets.

@kyktommy
Last active December 31, 2019 03:44
Show Gist options
  • Save kyktommy/5b9bba922c5f62931f7a89727eadda15 to your computer and use it in GitHub Desktop.
Save kyktommy/5b9bba922c5f62931f7a89727eadda15 to your computer and use it in GitHub Desktop.
find project in gopath
function findgo() {
find $GOPATH/src -mindepth 3 -maxdepth 3 -type d -exec ls -ld "{}" \; | grep $1 | awk '{ print $9 }' | nl
}
findgo gogo
function cdgo() {
r=$(findgo $1)
echo $r
printf 'cd to ? > '
read cdto
p=$(echo $r | sed -n "${cdto}p" | awk '{ print $2 }')
cd $p
}
cdgo gogo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment