Skip to content

Instantly share code, notes, and snippets.

@ericychoi
Created November 4, 2016 17:36
Show Gist options
  • Save ericychoi/24a44ac2a5c48980a1bf720d742262e5 to your computer and use it in GitHub Desktop.
Save ericychoi/24a44ac2a5c48980a1bf720d742262e5 to your computer and use it in GitHub Desktop.
Go Get using Git Clone
# use git clone to clone the go repo to the right location in your gopath
function goget() {
# github.com/foo/bar
GIT_PATH="$@"
# git@github.com:foo/bar.git
GIT_CLONE_PATH=`echo "$GIT_PATH" | perl -lape 's!(.+?)/!git\@$1:!'`
mkdir -p "$GOPATH/src/$GIT_PATH" && git clone "$GIT_CLONE_PATH" "$GOPATH/src/$GIT_PATH"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment