File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 3838
3939# -------------------------------------------------------#
4040# #Install
41+ # Check if Go is already installed and remove it
42+ if command -v go > /dev/null 2>&1 ; then
43+ EXISTING_GO=" $( command -v go) "
44+ EXISTING_GOROOT=" $( go env GOROOT 2> /dev/null || echo " " ) "
45+ echo " [!] Found existing Go installation at: ${EXISTING_GO} "
46+ [[ -n " ${EXISTING_GOROOT} " ]] && echo " [!] GOROOT: ${EXISTING_GOROOT} "
47+
48+ # Remove from common system locations
49+ for sys_path in " /usr/local/go" " /usr/go" " /opt/go" ; do
50+ [[ -d " ${sys_path} " ]] && { echo " [!] Removing system Go: ${sys_path} " && sudo rm -rf " ${sys_path} " ; }
51+ done
52+
53+ # Remove from user locations
54+ [[ -n " ${EXISTING_GOROOT} " && -d " ${EXISTING_GOROOT} " && " ${EXISTING_GOROOT} " != " ${GO_DIR} " ]] && {
55+ echo " [!] Removing existing GOROOT: ${EXISTING_GOROOT} "
56+ rm -rf " ${EXISTING_GOROOT} "
57+ }
58+ fi
4159# Clean Existing
4260[[ -d " ${GO_DIR} " ]] && rm -rf " ${GO_DIR} "
4361[[ -d " ${GO_BIN_DIR} " ]] && rm -rf " ${GO_BIN_DIR} "
You can’t perform that action at this time.
0 commit comments