Skip to content

Instantly share code, notes, and snippets.

@benoitpetit
Last active April 28, 2023 20:13
Show Gist options
  • Save benoitpetit/dea0f6e5b97ffc71f9d32856ec993670 to your computer and use it in GitHub Desktop.
Save benoitpetit/dea0f6e5b97ffc71f9d32856ec993670 to your computer and use it in GitHub Desktop.
golang installation script for fedora
import os
# Request the version to be installed
print("check here => https://go.dev/dl/")
version = input("Which version of Golang do you want to install? ")
# Downloading and installing Golang
os.system(f"sudo dnf install -y wget")
os.system(f"wget https://golang.org/dl/go{version}.linux-amd64.tar.gz")
os.system(f"sudo tar -C /usr/local -xzf go{version}.linux-amd64.tar.gz")
# Configuration of the environment
os.system(f"echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc")
os.system(f"echo 'export GOPATH=$HOME/go' >> ~/.bashrc")
os.system(f"echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc")
os.system(f"source ~/.bashrc")
# Check installation
os.system(f"if go version; then echo 'Go is installed'; fi")
import os
# Request the version to be installed
print("check here => https://go.dev/dl/")
version = input("Which version of Golang do you want to install? ")
# Downloading and installing Golang
os.system(f"sudo apt update")
os.system(f"wget https://golang.org/dl/go{version}.linux-amd64.tar.gz")
os.system(f"sudo tar -C /usr/local -xzf go{version}.linux-amd64.tar.gz")
# Configuration of the environment
os.system(f"echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc")
os.system(f"echo 'export GOPATH=$HOME/go' >> ~/.bashrc")
os.system(f"echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc")
os.system(f"source ~/.bashrc")
# Check installation
os.system(f"if go version; then echo 'Go est installé'; fi")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment