File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -406,9 +406,29 @@ function install_go_25() {
406406 local __url=" https://dl.google.com/go/$__file "
407407 if ! [[ -d " /usr/local/go" ]]; then
408408 log " Installing Golang $__version "
409+ # Create a temporary folder
410+ local __tmpdir
411+ __tmpdir=$( mktemp -d /tmp/go-install-XXXXXX) || {
412+ _log " Failed to create temporary directory for Go installation"
413+ return 1
414+ }
415+ if [[ -z " $__tmpdir " || ! -d " $__tmpdir " ]]; then
416+ _log " Temporary directory for Go installation is invalid: '$__tmpdir '"
417+ return 1
418+ fi
419+ cd " $__tmpdir "
420+
421+ # Download and extract in temp folder
409422 sudo curl -sO " $__url "
410423 sudo tar -xf " $__file "
424+
425+ # Move to final destination
411426 sudo mv go /usr/local
427+
428+ # Clean up temp folder
429+ cd -
430+ sudo rm -rf " $__tmpdir "
431+
412432 echo " export PATH=$PATH :/usr/local/go/bin" | sudo tee -a /etc/profile
413433 source /etc/profile
414434 go version
You can’t perform that action at this time.
0 commit comments