From 18bb8421ac5593f7b40e15937cb3a66345bf2fca Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 6 Feb 2016 00:44:14 +0100
Subject: [PATCH] Add optional golang setup, and vimrc entensibility.

---
 dotfiles/minimal/vimrc     |  3 +++
 dotfiles/minimal/vimrc_add |  0
 setup_go.sh                | 45 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
 create mode 100644 dotfiles/minimal/vimrc_add
 create mode 100755 setup_go.sh

diff --git a/dotfiles/minimal/vimrc b/dotfiles/minimal/vimrc
index 0103b0a..485351c 100644
--- a/dotfiles/minimal/vimrc
+++ b/dotfiles/minimal/vimrc
@@ -25,3 +25,6 @@ autocmd BufEnter * :syntax sync fromstart
 
 " Mark the 80-th column.
 set colorcolumn=80
+
+" Source additions
+source ~/.vimrc_add
diff --git a/dotfiles/minimal/vimrc_add b/dotfiles/minimal/vimrc_add
new file mode 100644
index 0000000..e69de29
diff --git a/setup_go.sh b/setup_go.sh
new file mode 100755
index 0000000..fabdce8
--- /dev/null
+++ b/setup_go.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -e
+set -x
+
+ensure_line() {
+    add_string="$1"
+    file="$2"
+    echo "TESTESTEST"
+    echo $add_string
+    echo $file
+    test=`grep "$add_string" "$file" | wc -l`
+    if [ $test -lt 1 ]; then
+        echo "$add_string" >> "$file"
+    fi
+}
+
+filename=temp_golang_binary
+
+if [ "$1" = "" ]; then
+    echo 'Need URL of current go package'
+    exit 1
+fi
+sudo rm -rf /usr/local/go
+sudo apt-get -y install wget
+wget -O $filename $1
+sudo tar -C /usr/local -xzf $filename
+rm $filename
+ensure_line 'export PATH=$PATH:/usr/local/go/bin' ~/.shinit_add
+ensure_line 'export GOPATH=~/gopath' ~/.shinit_add
+sudo apt-get -y install vim-pathogen
+rm -rf ~/.vim/bundle/vim-go
+git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go
+ensure_line 'source ~/.vimrc_vimgo' ~/.vimrc_add
+cat << EOF > ~/.vimrc_vimgo
+" vim-go: Make vim-go run.
+call pathogen#infect()
+let g:go_disable_autoinstall = 0
+" vim-go: Highlight
+let g:go_highlight_functions = 1
+let g:go_highlight_methods = 1
+let g:go_highlight_structs = 1
+let g:go_highlight_operators = 1
+let g:go_highlight_build_constraints = 1
+EOF
-- 
2.30.2