Created
March 8, 2019 14:30
-
-
Save dschulz/12475b0e6fc6eb617d3147621346e911 to your computer and use it in GitHub Desktop.
Script para instalar o actualizar Golang
This file contains 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/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Eres un crack