Last active
December 31, 2019 03:44
-
-
Save kyktommy/5b9bba922c5f62931f7a89727eadda15 to your computer and use it in GitHub Desktop.
find project in gopath
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
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