Hanchengluo / golang-install

One key installation of the latest version of the golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang Install


The latest version of the golang is installed.

  • Support Linux / MacOS / FreeBSD
  • Support custom version
  • Support custom GOPATH

English | 简体中文

Notice

  • GOROOT: $HOME/.go
  • By default, the latest version of go version is installed, and the GOPATH directory is $HOME/go

Installation

Online

Default install

curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash

Custom version

  • MY_DIY_GO_VERSION is a custom golang version, such as: 1.12.8
  • MY_DIY_GO_PATH is a custom gopath, such as: /home/myhome/go
curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash -s -- -v MY_DIY_GO_VERSION -d MY_DIY_GO_PATH

Offline

Save the script as a file name install.sh

# default install
bash install.sh   
   
# customize  
bash install.sh -v 1.12.8 -d /home/myhome/go 

When you add executable permissions, you can customize the version and gopath.

# add executable
chmod +x install.sh

# default install
./install.sh

# customize 
./install.sh -v 1.12.8 -d /home/myhome/go

Usage
./install.sh -h

Go install

Usage: ./install.sh [-h] [-v version] [-d gopath]

Options:
  -h            : this help
  -v            : set go version (default: latest version)
  -d            : set go path (default: $HOME/go)

License

This project is licensed under the MIT license.

About

One key installation of the latest version of the golang

License:MIT License


Languages

Language:Shell 100.0%