Skip to content

Instantly share code, notes, and snippets.

@dschulz
Created March 8, 2019 14:30
Show Gist options
  • Save dschulz/12475b0e6fc6eb617d3147621346e911 to your computer and use it in GitHub Desktop.
Save dschulz/12475b0e6fc6eb617d3147621346e911 to your computer and use it in GitHub Desktop.
Script para instalar o actualizar Golang
#!/bin/bash
if [ $EUID -ne 0 ]; then
echo "No sos root, chau"
exit 1
fi
URL="https://dl.google.com/go/go1.12.linux-amd64.tar.gz"
BASE='/usr/local'
GOROOT="${BASE}/go"
GOBIN="${GOROOT}/bin"
# Ya existe una version vieja, eliminar
if [ -d ${GOROOT} ]; then
rm -fr ${GOROOT:-/usr/local/go}
fi
wget ${URL} -O - | tar xzf - -C ${BASE}
cat<<EOT | tee /etc/profile.d/golang.sh
# Configurar entorno para Golang
export PATH=${GOBIN}:${PATH}
EOT
chmod +x /etc/profile.d/golang.sh
source /etc/profile.d/golang.sh
go version
echo "Reinicia tu sesion para recargar el entorno"
@dev-mophy
Copy link

Eres un crack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment