Skip to content

Instantly share code, notes, and snippets.

@thanosp
Last active August 12, 2020 07:38
Show Gist options
  • Save thanosp/5e7368fc7495d1766c9fd0d3639117bb to your computer and use it in GitHub Desktop.
Save thanosp/5e7368fc7495d1766c9fd0d3639117bb to your computer and use it in GitHub Desktop.
shell function to find and go to the directory of a go project
# go to the source of a go project in $GOPATH
# Usage: $ figo projectname
figo () {
FIGODIR=`find $GOPATH/src -name "$1" -print -maxdepth 3 | grep -v vendor | head -n1`
if [ "$FIGODIR" = "" ]; then FIGODIR=`find $GOPATH/src -name "$1" -print -maxdepth 4 | grep -v vendor | head -n1`; fi
cd $FIGODIR
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment