github.com/anuvu/nomad@v0.8.7-atom1/scripts/vagrant-linux-priv-go.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  function install_go() {
     4  	local go_version=1.10.7
     5  	local download=
     6  
     7  	download="https://storage.googleapis.com/golang/go${go_version}.linux-amd64.tar.gz"
     8  
     9  	wget -q -O /tmp/go.tar.gz ${download}
    10  
    11  	tar -C /tmp -xf /tmp/go.tar.gz
    12  	sudo mv /tmp/go /usr/local
    13  	#sudo chown -R root:root /usr/local/go
    14  }
    15  
    16  install_go
    17  	
    18  # Ensure that the GOPATH tree is owned by vagrant:vagrant
    19  #mkdir -p /opt/gopath
    20  #chown -R vagrant:vagrant /opt/gopath
    21  
    22  # Ensure Go is on PATH
    23  if [ ! -e /usr/bin/go ] ; then
    24  	ln -s /usr/local/go/bin/go /usr/bin/go
    25  fi
    26  if [ ! -e /usr/bin/gofmt ] ; then
    27  	ln -s /usr/local/go/bin/gofmt /usr/bin/gofmt
    28  fi
    29  
    30  
    31  # Ensure new sessions know about GOPATH
    32  if [ ! -f /etc/profile.d/gopath.sh ] ; then
    33  	cat <<EOT > /etc/profile.d/gopath.sh
    34  export GOPATH="/opt/gopath"
    35  export PATH="/opt/gopath/bin:\$PATH"
    36  EOT
    37  	chmod 755 /etc/profile.d/gopath.sh
    38  fi