Code Monkey home page Code Monkey logo

go-installer's Introduction

Go Installer ๐Ÿน

Install Golang on Linux or Mac with hassle of environment variables setting.

Contributions Welcome .github/workflows/test.yml

How to use it ๐Ÿค”

Installing (or even updating) Go โฌ‡๏ธ

You can clone the repository then run bash go.sh.

Or by simply running whatever suits you from the following commands (wget1 or curl):

# downloads then runs the script
wget https://git.io/go-installer.sh && bash go-installer.sh
# 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 โ˜•, sit back ๐Ÿ˜Œ and relax while the magic happens! ๐Ÿ”ฎ

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 the location where Go will be installed to. $HOME/go is the default workspace.

In order to install Go to other location or set custom workspace. You can set environment variables GOROOT or GOPATH before installing (or uninstalling) Go.

For example:

export GOROOT=/opt/go            # where Go is installed
export GOPATH=$HOME/projects/go  # your workspace

Read more about workspaces in Go.

Specifying a version to install ๐Ÿง

By default the script installs the lastest 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 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 https://go.dev/dl 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.
Demo.mp4

๐Ÿ”ฅ WORKS LIKE A CHARM ๐Ÿš€

Footnotes

  1. the script depends on wget (1, 2) โ†ฉ

go-installer's People

Contributors

kerolloz avatar kranurag7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-installer's Issues

Raspberry PI - downloaded index.html

Hi,
I'm trying to use the script on a Raspberry PI, and this is the result that I get:
image

Am I doing something wrong? I've tried to both download it and executing it directly.

Option to remove tar.gz after install?

Are you open to adding an option to clean up the downloaded artifact or do this by default?

It's ever so slightly annoying to have to do this manually after a new version gets installed.

.bashrc fills with exports

If the installation script from https://git.io/go-installer is run multiple times. Exports are keep appending to .bashrc.
This is the result after 2 installations

export GOROOT=/home/tango/.go
export GOPATH=/home/tango/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GOROOT=/home/tango/.go
export GOPATH=/home/tango/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

I am using ansible-playbook to install if it makes any difference:

- name: Install GO
  shell: curl -sL https://git.io/go-installer | bash -

add more features and functionality

User can :

  • #12
  • choose whether to remove the installer(the downloaded package file) or not after installation
  • specify the place of extracting go binary (GOROOT) && workplace(GOPATH).
  • #11

Broken installation

Installing without root shows fails and asks for root.

Running with sudo installs to /root/ making it inaccessible to other users.

handle installing versions with non-numerical values

Trying to install versions like go1.19rc1 and go1.19beta1 gives an error because we check if the specified version matches the three numbers, separated by two dots format (e.g. 1.2.3). We can skip the regex matching and depend only on seeing if the selected version exists on the website.

go version 1.16

Hi, I latest version of go is 1.16 which means the current version regex is not working with it. Can you fix it please? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.