Last active
          June 26, 2022 09:49 
        
      - 
      
- 
        Save renevo/d0ac29ebfd9c600f7f279476ff6c6112 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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 | |
| set -e | |
| GVERSION="1.7.5" | |
| GFILE="go$GVERSION.linux-amd64.tar.gz" | |
| GOPATH="$HOME/go" | |
| GOROOT="/usr/local/go" | |
| if [ -d $GOROOT ]; then | |
| echo "Installation directories already exist $GOROOT" | |
| exit 1 | |
| fi | |
| mkdir -p "$GOROOT" | |
| chmod 777 "$GOROOT" | |
| wget --no-verbose https://storage.googleapis.com/golang/$GFILE -O $TMPDIR/$GFILE | |
| if [ $? -ne 0 ]; then | |
| echo "Go download failed! Exiting." | |
| exit 1 | |
| fi | |
| tar -C "/usr/local" -xzf $TMPDIR/$GFILE | |
| touch "$HOME/.bashrc" | |
| { | |
| echo '# GoLang' | |
| echo 'export PATH=$PATH:/usr/local/go/bin' | |
| echo 'export GOPATH=$HOME/go' | |
| echo 'export PATH=$PATH:$GOPATH/bin' | |
| } >> "$HOME/.bashrc" | |
| source "$HOME/.bashrc" | |
| echo "GOROOT set to $GOROOT" | |
| mkdir -p "$GOPATH" "$GOPATH/src" "$GOPATH/pkg" "$GOPATH/bin" "$GOPATH/out" | |
| chmod 777 "$GOPATH" "$GOPATH/src" "$GOPATH/pkg" "$GOPATH/bin" "$GOPATH/out" | |
| echo "GOPATH set to $GOPATH" | |
| rm -f $TMPDIR/$GFILE | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Uh oh!
There was an error while loading. Please reload this page.