Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Last active March 22, 2017 12:59
Show Gist options
  • Save dillonhafer/8a65d835e01131ac6a57841436f73e8f to your computer and use it in GitHub Desktop.
Save dillonhafer/8a65d835e01131ac6a57841436f73e8f to your computer and use it in GitHub Desktop.
function gonew {
if (( $# == 1 )); then
new_project="$GOPATH/src/github.com/dillonhafer/$1"
if [ -d "$new_project" ]; then
echo -e "\033[0;31mProject already exists\033[0m"
return
fi
mkdir -p $new_project
cd $new_project
git init .
echo -e "$1" > .gitignore
echo -e "# $1" > README.md
$EDITOR main.go
else
echo "USAGE: gonew [folder]"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment