Skip to content

Instantly share code, notes, and snippets.

@widnyana
Last active October 19, 2015 11:02
Show Gist options
  • Save widnyana/614e461e97717a5b4369 to your computer and use it in GitHub Desktop.
Save widnyana/614e461e97717a5b4369 to your computer and use it in GitHub Desktop.
golang workspace initiator
#!/usr/bin/env bash
# widnyana - Noisegate Labs.
echo "Creating workspace layout for base Golang Project..."
# ===
read -p ">>> Enter new Foldername to store your project: " dirname
read -p ">>> Enter the url package will reside: " pkgurl
# ===========================================
echo ">>> Creating dir..."
CWD=${PWD}
PKGPATH="$CWD/$dirname"
mkdir -p $PKGPATH
cd $PKGPATH
mkdir bin src pkg
# ===========================================
echo ">>> Creating .editorconfig file..."
echo -e "; This file is for unifying the coding style for different editors and IDEs.
; More information at http://EditorConfig.org
root = true
[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.go]
indent_size = 4
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
" >> .editorconfig
# ===
echo ">>> Creating pkg folder..."
cd src
mkdir -p "$pkgurl"
cd $pkgurl && git init .
cd $PKGPATH
# ===
echo "Creating GOPATH activator..."
echo -e "export GOPATH=$PKGPATH" >> activate
# ===
echo "Done, Your working directory is in: $PKGPATH
!!! Use . ./activate to activate your current GOPATH
Happy coding..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment