Skip to content

kubex-ecosystem/gosetup

Repository files navigation

GoSetup Banner

GoSetup 🐹 ⚡ - Smart Go Installer

🚀 Easily install and configure Golang on Linux, Mac, and Windows—fast and hassle-free!

Contributions Welcome License Version


🚀 Quick Installation

🏎️ Instant Method (wget/curl)

wget https://raw.githubusercontent.com/kubex-ecosystem/gosetup/refs/heads/main/go.sh && bash gosetup.sh
bash <(curl -sL https://git.io/gosetup)

🛠️ Cloning the Repository and Running Manually

git clone https://github.com/kubex-ecosystem/gosetup.git
cd gosetup
bash go.sh

💡 Tip: By default, Go will be installed in $HOME/.go, and $HOME/go will be set as the workspace. You can customize these locations by setting GOROOT and GOPATH before installation:

export GOROOT=/opt/go
export GOPATH=$HOME/projects/go

🎯 Features

Automatic installation & updatesSpecify a Go version to installCompatible with Windows, Linux, and macOSSmart environment configurationSupports multiple architectures (ARM, AMD64, i386)Seamless integration with GitHub Actions workflows


🛠️ Essential Commands

🔹 Install or update Go

bash go.sh install
.\go.ps1 -Command install

🔹 Specify a version

bash go.sh install --version 1.19.4
.\go.ps1 -Command install -Version 1.19.2

🔹 Check if a version is installed

bash go.sh check --version 1.19.4
.\go.ps1 -Command check -Version 1.19.2

🔹 Uninstall Go

bash go.sh remove
.\go.ps1 -Command remove

🔹 Display the help menu

bash go.sh help
.\go.ps1 -Command help

🐳 Running Tests with Docker

Ensure a clean testing environment:

make test
.\go.ps1 -Command test

💡 Contribute to the Project

  1. Star the repository to show support!
  2. 🔄 Fork and clone the repository.
  3. 🛠️ Create a new branch and make your changes.
  4. 📌 Submit a pull request and wait for review.
  5. 🎉 Join the community and stay updated!

🔍 How It Works

The script follows these steps: 1️⃣ Detects your operating system and architecture. 2️⃣ Checks the latest available Go version. 3️⃣ Downloads & installs the correct version. 4️⃣ Sets up directories (GOROOT, GOPATH). 5️⃣ Adds Go binaries to PATH automatically. 6️⃣ Cleans up unnecessary files to keep things efficient.


🛠️ Using in CI/CD with GitHub Actions

Automate Go installation based on the version specified in go.mod:

- name: Install Go (Exact version from go.mod)
  run: |
    export NON_INTERACTIVE=true
    bash -c "$(curl -sSfL 'https://raw.githubusercontent.com/kubex-ecosystem/gosetup/main/go.sh')" -s --version "$(grep '^go ' go.mod | awk '{print $2}')"

🚀 **Simple. Fast. Powerful.** 🔥