Last active
May 10, 2017 10:51
-
-
Save boseji/c8f4bacc98812310ce6ec250a761cad5 to your computer and use it in GitHub Desktop.
Cloud9 Golang configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
################### | |
### Cloud9 Golang Configuration | |
### by boseji | |
### | |
### Version 0.0 - Initial Release | |
### | |
################### | |
################### | |
## CONFIG | |
# Show all Commands | |
# set -x | |
################### | |
## FUNCTIONS | |
gitconfig (){ | |
# Make sure we exit if any command fails | |
set -e | |
# clear the Git Configuration make a new one | |
echo "-----------------------------------" | |
echo "Removing the older gitconfig..." | |
echo "-----------------------------------" | |
rm -rf $HOME/.gitconfig | |
echo | |
# Install the new Configuration | |
echo "-----------------------------------" | |
echo "Downloading new getconfig..." | |
echo "-----------------------------------" | |
echo | |
wget -c -O $HOME/.gitconfig https://gist.github.com/boseji/2fac2c7894a8e5c63435fd3a3e28d55d/raw/63d9927017e1e17832cf93435893b17ef8dd9e5f/.gitconfig | |
echo | |
set +e | |
echo "-----------------------------------" | |
read -p "Enter Github User ID (boseji): " NAME | |
NAME=${NAME:-boseji} | |
git config --global user.id $NAME | |
echo | |
echo "User ID: " | |
git config --global user.id | |
echo "-----------------------------------" | |
echo | |
echo "-----------------------------------" | |
read -p "Github User Email ([email protected]):" EMAIL | |
EMAIL=${EMAIL:-"[email protected]"} | |
git config --global user.email $EMAIL | |
echo | |
echo "User Email: " | |
git config --global user.email | |
echo "-----------------------------------" | |
echo | |
sleep 2 | |
} | |
golang () { | |
echo | |
echo "-----------------------------------" | |
echo "Installing golang ..." | |
echo "-----------------------------------" | |
echo | |
set -e | |
sudo rm -rf /opt/go | |
echo | |
echo "-----------------------------------" | |
echo "Downloading golang distribution ..." | |
echo "-----------------------------------" | |
echo | |
wget -c https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | |
echo | |
echo "-----------------------------------" | |
echo "Extracting to /opt/go ..." | |
echo "-----------------------------------" | |
echo | |
echo "please wait..." | |
sudo tar -C /opt -xzf go1.8.1.linux-amd64.tar.gz | |
echo | |
rm -rf go1.8.1.linux-amd64.tar.gz | |
echo | |
set +e | |
echo | |
echo "-----------------------------------" | |
echo "Installed :" | |
go version | |
echo "-----------------------------------" | |
echo | |
echo | |
echo "-----------------------------------" | |
echo "Creating Directory Setup :" | |
echo | |
cd $HOME/workspace | |
if [ ! -d src ]; then | |
mkdir src | |
fi | |
if [ ! -d pkg ]; then | |
mkdir pkg | |
fi | |
if [ ! -d bin ]; then | |
mkdir bin | |
fi | |
echo "-----------------------------------" | |
echo | |
echo | |
echo "-----------------------------------" | |
echo "Adding Bin directory to Path" | |
echo "-----------------------------------" | |
export PATH=$PATH:$HOME/workspace/bin | |
echo $PATH | |
echo | |
} | |
gotools () { | |
set +e | |
echo | |
echo "-----------------------------------" | |
echo "Installing Tools :" | |
echo "-----------------------------------" | |
echo | |
echo "goimports" | |
go get -u golang.org/x/tools/cmd/goimports | |
echo | |
echo "golint" | |
go get -u github.com/golang/lint/golint | |
echo | |
#echo "gb" | |
#go get -u github.com/constabulary/gb/... | |
#echo | |
echo "depth" | |
go get -u github.com/KyleBanks/depth/cmd/depth | |
echo | |
echo "godoc" | |
go get -u golang.org/x/tools/cmd/godoc | |
echo | |
} | |
surgetool() { | |
echo | |
echo "-----------------------------------" | |
echo "Installing Surge Tool (optional) :" | |
echo " For Web publishing" | |
echo "-----------------------------------" | |
echo | |
npm install --global surge | |
} | |
#################### | |
## MAIN | |
gitconfig | |
golang | |
gotools | |
#surgetool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment