andrew c0011e47fa Squashed 'golang-install/' changes from 258f94f..2bb9d3b
2bb9d3b Adjust i686 architecture to point to the 386's release
f4cf04a Updated to output a new line before inserting variables into the shell profile file
bfd24d9 Update to Go 1.20.6
9651981 Update goinstall.sh (#69)

git-subtree-dir: golang-install
git-subtree-split: 2bb9d3b603709fcbe2fb27b26c70bf0ffee0d4dc
2023-09-27 15:25:57 -04:00

golang-tools-install-script

Bash script to automate installation and removal of single-user Go language tools.

Feel free to change the variables on the beginning to match whatever version of Go you need.

Tested working on:

  • Ubuntu 16.04 to 20.04
  • macOS Sierra (10.12) to Big Sur (11.3)

Supported shells:

  • Bash, fish, Zsh

🔨 Requirements

  • wget or curl
  • Bash shell

Install

Download and run with wget or curl. Here's the short version using the official git.io shortening:

# Linux typically has wget installed
wget -q -O - https://git.io/vQhTU | bash

# macOS typically has curl installed
curl -L https://git.io/vQhTU | bash

Or, if you are more comfortable with the raw URL:

wget -q -O - https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash

# or...
curl https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash

📦 Install a custom Go version

Pass the --version option into the script including the version that you wish to install.

Example:
wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.18

# or...
curl -L https://git.io/vQhTU | bash -s -- --version 1.18

🚫 Uninstall

Pass the --remove option into the script:

wget -q -O - https://git.io/vQhTU | bash -s -- --remove

# or...
curl -L https://git.io/vQhTU | bash -s -- --remove

📝 Notes

By default, the script will create .go and go folders on your home directory and add the needed variables and PATH expansion.

$HOME/.go is the directory where Go will be installed to.

$HOME/go is the default workspace directory.

Read more about the workspace.

In order to install Go into another location, set the environment variables $GOROOT and $GOPATH before (un)installing:

export GOROOT=/opt/go
export GOPATH=$HOME/projects/go
S
Description
Collection of shell scripts for linux servers.
https://code.digitaladapt.com/public/shell-scripts Readme MIT
3.9 MiB
Languages
Shell 52.9%
Vim Script 38%
Python 7.6%
PowerShell 1%
JavaScript 0.2%
Other 0.2%