Skip to content

Instantly share code, notes, and snippets.

@maurobaraldi
Forked from gsrai/install_go.sh
Created October 29, 2024 14:50
Show Gist options
  • Save maurobaraldi/37451005f1ef7cbb8d70e43f0b2c9e5a to your computer and use it in GitHub Desktop.
Save maurobaraldi/37451005f1ef7cbb8d70e43f0b2c9e5a to your computer and use it in GitHub Desktop.

Revisions

  1. @gsrai gsrai revised this gist Apr 16, 2024. No changes.
  2. @gsrai gsrai revised this gist Aug 25, 2023. 2 changed files with 22 additions and 21 deletions.
    20 changes: 0 additions & 20 deletions install_go.sh
    Original file line number Diff line number Diff line change
    @@ -14,23 +14,3 @@ sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME
    echo 'export GOROOT="/usr/local/go"' >> $HOME/.zshrc
    echo 'export GOPATH="$HOME/dev/go"' >> $HOME/.zshrc
    echo 'export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"' >> $HOME/.zshrc


    #!/usr/bin/env bash

    # find filename on https://go.dev/dl/
    GO_FILE_NAME="go1.21.0.darwin-arm64.tar.gz" # M1 Apple Silicon

    # usage:
    # chmod u+x update_go.sh
    # sudo ./update_go.sh

    sudo mv /usr/local/go /usr/local/_go_old
    mkdir /tmp/downloads
    sudo wget https://golang.org/dl/$GO_FILE_NAME -P /tmp/downloads
    sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME

    go version

    # if something goes wrong, just restore the backup `mv /usr/local/_go_old /usr/local/go`
    # if everything is ok, then you can remove the backup `sudo rm -rf /usr/local/_go_old`
    23 changes: 22 additions & 1 deletion update_go.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,22 @@
    sdf
    #!/usr/bin/env bash

    # Find filename on https://go.dev/dl/
    GO_FILE_NAME="go1.21.0.darwin-arm64.tar.gz" # M1 Apple Silicon

    # Usage:
    # chmod u+x update_go.sh
    # sudo ./update_go.sh
    #
    # If something goes wrong, just restore the backup:
    # mv /usr/local/_go_old /usr/local/go
    #
    # If everything is ok, then you can remove the backup:
    # sudo rm -rf /usr/local/_go_old

    sudo mv /usr/local/go /usr/local/_go_old
    mkdir /tmp/downloads
    sudo wget https://golang.org/dl/$GO_FILE_NAME -P /tmp/downloads
    sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME

    go version

  3. @gsrai gsrai revised this gist Aug 25, 2023. 2 changed files with 20 additions and 2 deletions.
    21 changes: 19 additions & 2 deletions install_go.sh
    Original file line number Diff line number Diff line change
    @@ -15,5 +15,22 @@ echo 'export GOROOT="/usr/local/go"' >> $HOME/.zshrc
    echo 'export GOPATH="$HOME/dev/go"' >> $HOME/.zshrc
    echo 'export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"' >> $HOME/.zshrc

    source $HOME/.zshrc
    go version

    #!/usr/bin/env bash

    # find filename on https://go.dev/dl/
    GO_FILE_NAME="go1.21.0.darwin-arm64.tar.gz" # M1 Apple Silicon

    # usage:
    # chmod u+x update_go.sh
    # sudo ./update_go.sh

    sudo mv /usr/local/go /usr/local/_go_old
    mkdir /tmp/downloads
    sudo wget https://golang.org/dl/$GO_FILE_NAME -P /tmp/downloads
    sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME

    go version

    # if something goes wrong, just restore the backup `mv /usr/local/_go_old /usr/local/go`
    # if everything is ok, then you can remove the backup `sudo rm -rf /usr/local/_go_old`
    1 change: 1 addition & 0 deletions update_go.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    sdf
  4. @gsrai gsrai created this gist Nov 6, 2022.
    19 changes: 19 additions & 0 deletions install_go.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/usr/bin/env bash

    # find filename on https://go.dev/dl/
    GO_FILE_NAME="go1.19.3.darwin-arm64.tar.gz"

    # usage:
    # chmod u+x install_go.sh
    # sudo ./install_go.sh

    mkdir /tmp/downloads
    sudo wget https://golang.org/dl/$GO_FILE_NAME -P /tmp/downloads
    sudo tar -C /usr/local -xzf /tmp/downloads/$GO_FILE_NAME

    echo 'export GOROOT="/usr/local/go"' >> $HOME/.zshrc
    echo 'export GOPATH="$HOME/dev/go"' >> $HOME/.zshrc
    echo 'export PATH="$GOPATH/bin:$GOROOT/bin:$PATH"' >> $HOME/.zshrc

    source $HOME/.zshrc
    go version