Skip to content

Instantly share code, notes, and snippets.

@tmichel
Created October 15, 2014 13:37
Show Gist options
  • Select an option

  • Save tmichel/5aff9145f0077cbfb9a6 to your computer and use it in GitHub Desktop.

Select an option

Save tmichel/5aff9145f0077cbfb9a6 to your computer and use it in GitHub Desktop.
cd into go packages from anywhere
# 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