Created
October 15, 2014 13:37
-
-
Save tmichel/5aff9145f0077cbfb9a6 to your computer and use it in GitHub Desktop.
cd into go packages from anywhere
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
| # functions | |
| function gcd () | |
| { | |
| local pdir=$(go list -f '{{ .Dir }}' $1 2>/dev/null ) | |
| if [ -z "$pdir" ]; then | |
| pdir=$(go list -f '{{ .Dir }}' ".../$1" 2>/dev/null) | |
| fi | |
| if [ -z "$pdir" ]; then | |
| echo "no directory found for pkg $1" | |
| return; | |
| fi; | |
| cd $pdir | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment