Add initial Go installation script and setup files
This commit is contained in:
@@ -1,2 +1,6 @@
|
||||
# go-install
|
||||
a curl/bash script to install the latest version of golang
|
||||
|
||||
## usage
|
||||
|
||||
tbd
|
||||
4
go.env
Normal file
4
go.env
Normal file
@@ -0,0 +1,4 @@
|
||||
export GOBIN=$HOME/.local/bin
|
||||
export GOPATH=$HOME
|
||||
export GOROOT=$HOME/go
|
||||
export PATH=$GOROOT/bin:$GOBIN:/usr/local/go/bin:$PATH
|
||||
23
install.sh
Executable file
23
install.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Install Go
|
||||
wget https://go.dev/dl/go1.25.1.linux-amd64.tar.gz
|
||||
tar -xzf go1.25.1.linux-amd64.tar.gz
|
||||
sudo rm -rf $HOME/go
|
||||
mv go "$HOME"
|
||||
rm go1.25.1.linux-amd64.tar.gz
|
||||
|
||||
# Remove any existing Go-related exports from /etc/profile
|
||||
# A backup will be created at /etc/profile.bak
|
||||
sed -i.bak \
|
||||
-e '/export GOBIN/d' \
|
||||
-e '/export GOPATH/d' \
|
||||
-e '/export GOROOT/d' \
|
||||
$HOME/.bashrc
|
||||
|
||||
# Append the desired Go environment variables
|
||||
cat go.env || sudo tee $HOME/.bashrc
|
||||
source go.env
|
||||
|
||||
echo "run 'source ~/.bashrc' to activate the Go installation or close this terminal and open a new one"
|
||||
Reference in New Issue
Block a user