github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/builtin/app/go/data/common/dev/layer-base/Vagrantfile.tpl (about) 1 {% extends "compile:data/app/dev/Vagrantfile-layer.tpl" %} 2 3 {% block vagrant_config %} 4 # Install Go build environment 5 config.vm.provision "shell", inline: $script_golang 6 {% endblock %} 7 8 {% block footer %} 9 $script_golang = <<SCRIPT 10 set -e 11 12 oe() { $@ 2>&1 | logger -t otto > /dev/null; } 13 ol() { echo "[otto] $@"; } 14 15 # If we have Go, then do nothing 16 if command -v go >/dev/null 2>&1; then 17 ol "Go already installed! Otto won't install Go." 18 exit 0 19 fi 20 21 ol "Downloading Go {{ dev_go_version }}..." 22 oe wget -q -O /home/vagrant/go.tar.gz https://storage.googleapis.com/golang/go{{ dev_go_version }}.linux-amd64.tar.gz 23 24 ol "Untarring Go..." 25 oe sudo tar -C /usr/local -xzf /home/vagrant/go.tar.gz 26 27 ol "Making GOPATH..." 28 oe sudo mkdir -p /opt/gopath 29 fstype=$(find /opt/gopath -mindepth 0 -maxdepth 0 -type d -printf "%F") 30 find /opt/gopath -fstype ${fstype} -print0 | xargs -0 -n 100 chown vagrant:vagrant 31 32 ol "Setting up PATH..." 33 echo 'export PATH=/opt/gopath/bin:/usr/local/go/bin:$PATH' >> /home/vagrant/.profile 34 echo 'export GOPATH=/opt/gopath' >> /home/vagrant/.profile 35 36 ol "Installing VCSs for go get..." 37 oe sudo apt-get update -y 38 oe sudo apt-get install -y git bzr mercurial 39 40 ol "Configuring Go to use SSH instead of HTTP..." 41 git config --global url."git@github.com:".insteadOf "https://github.com/" 42 SCRIPT 43 {% endblock %}