Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kerolloz/go-installer
Go-Installer: Effortless Golang Installation with One Command! 🚀
https://github.com/kerolloz/go-installer
bash bash-script go go-installer golang google install installer linux mac script shell shell-script
Last synced: about 2 months ago
JSON representation
Go-Installer: Effortless Golang Installation with One Command! 🚀
- Host: GitHub
- URL: https://github.com/kerolloz/go-installer
- Owner: kerolloz
- License: mit
- Created: 2019-06-04T12:32:00.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-14T17:58:16.000Z (5 months ago)
- Last Synced: 2024-08-14T19:34:00.814Z (5 months ago)
- Topics: bash, bash-script, go, go-installer, golang, google, install, installer, linux, mac, script, shell, shell-script
- Language: Shell
- Homepage:
- Size: 69.3 KB
- Stars: 124
- Watchers: 2
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Go Installer 🐹
> Install Golang on Linux or Mac with hassle of environment variables setting.
![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)
[![.github/workflows/test.yml](https://github.com/kerolloz/go-installer/actions/workflows/test.yml/badge.svg)](https://github.com/kerolloz/go-installer/actions/workflows/test.yml)## How to use it 🤔
### Installing (or even _updating_) Go ⬇️
You can _clone_ the repository and then run `bash go.sh`.
Or by simply running whatever suits you from the following commands (`wget`[^1] or `curl`):
[^1]: the script depends on wget ([1](https://github.com/kerolloz/go-installer/blob/836e09a79411cda39879a0ce8f69f199f4423562/go.sh#L67-L71), [2](https://github.com/kerolloz/go-installer/blob/836e09a79411cda39879a0ce8f69f199f4423562/go.sh#L132))
```bash
# downloads then runs the script
wget https://git.io/go-installer.sh && bash go-installer.sh
``````bash
# doesn't download the script ~ runs the script directly
bash <(curl -sL https://git.io/go-installer)
```Now, you can go grab a cup of coffee :coffee:, sit back :relieved: and relax while the magic happens! :crystal_ball:
> **Note**
> By default the script will create `.go` and `go` folders on your _HOME_ directory & add the needed variables to your _PATH_ variable.`$HOME/.go` is where Go will be installed.
`$HOME/go` is the default workspace.In order to install Go to another location or set custom workspace. You can set environment variables GOROOT or GOPATH before installing (or uninstalling) Go.
For example:
```bash
export GOROOT=/opt/go # where Go is installed
export GOPATH=$HOME/projects/go # your workspace
```Read more about [workspaces](https://go.dev/doc/code.html#Workspaces) in Go.
### Specifying a version to install 🧐
By default, the script installs the latest version available.
You can choose what version to install by adding the `--version` flag, followed by the version you want to install.```
bash go.sh --version 1.19.4
```### Show Help Message 🍁
To show the following help message use `bash go.sh help`.
### Uninstalling Go ❌
```bash
bash go.sh remove
```## How it works ⚙️
The script does the following steps:
- Checks if Go is already installed.
- Detects the installed operating system (Linux or Mac).
- Detects system architecture (armv6, armv8, amd64, i386).
- Parses the download page to find the latest version of Go that is available for your platform and architecture.
- Exits if you have the latest version of Go already installed.
- Downloads the latest version of Go.
- Creates the needed directories for workspace and Go binaries.
- Extracts the files of the downloaded package.
- Adds the binaries to PATH environment variable.
- Removes the downloaded installation file.https://user-images.githubusercontent.com/36763164/207317882-7e50e2de-628e-43f0-bf7c-bee6b1e68001.mp4
🔥 WORKS LIKE A CHARM 🚀