Skip to content

Instantly share code, notes, and snippets.

@mefellows
Last active August 29, 2015 14:15
Show Gist options
  • Save mefellows/dcdf85f70cdd71e21835 to your computer and use it in GitHub Desktop.
Save mefellows/dcdf85f70cdd71e21835 to your computer and use it in GitHub Desktop.
cg - Bash Alias function to switch to a go project
changedir_go() {
if [ "$#" -eq "2" ]; then
cd $GOPATH/src/github.com/$1/$2
else
cd $GOPATH/src/github.com/mefellows/$1
fi
}
alias cg=changedir_go
[email protected] /tmp $ cg
[email protected] ~/go/src/github.com/mefellows $ cg mirror
[email protected] ~/go/src/github.com/mefellows/mirror $ cg mitchellh packer
[email protected] ~/go/src/github.com/mitchellh/packer $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment