Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreasonable initial dependence #453

Open
LPX-E5BD8 opened this issue Nov 8, 2023 · 0 comments
Open

Unreasonable initial dependence #453

LPX-E5BD8 opened this issue Nov 8, 2023 · 0 comments

Comments

@LPX-E5BD8
Copy link

When installing in a brand new environment, it will rely on the go command.

The code is from .gvm/scripts/install, and when the script executes the compile_go method, it requires that the go command has already been installed in the system.

If you use this script on a system where no version of go has been installed, it will not be able to run.

compile_go() {
	display_message " * Compiling..."
	# Test for Windows
	case "$(uname)" in
	*MINGW* | *WIN32* | *CYGWIN*)
		MAKE_SCRIPT=make.bat
		;;
	*)
		MAKE_SCRIPT=make.bash
		;;
	esac
	[ -z "$GOROOT_BOOTSTRAP" ] && export GOROOT_BOOTSTRAP=$(go env GOROOT)         《-- this line
	unset GOARCH && unset GOOS && unset GOPATH && unset GOBIN && unset GOROOT &&
	export GOBIN=$GO_INSTALL_ROOT/bin &&
	export PATH=$GOBIN:$PATH &&
	export GOROOT=$GO_INSTALL_ROOT &&
	if [ ! -f "$GO_INSTALL_ROOT/VERSION" ]; then echo "$GO_NAME" > "$GO_INSTALL_ROOT/VERSION"; fi &&
	#builtin cd $GO_INSTALL_ROOT/src && ./all.bash &> $GVM_ROOT/logs/go-$GO_NAME-compile.log ||
	builtin cd "$GO_INSTALL_ROOT/src" && chmod -f +x $MAKE_SCRIPT && ./$MAKE_SCRIPT &> "$GVM_ROOT/logs/go-$GO_NAME-compile.log" ||
		(rm -rf "$GO_INSTALL_ROOT" && display_fatal "Failed to compile. Check the logs at $GVM_ROOT/logs/go-$GO_NAME-compile.log")
}

It's recommended to check if the go command exists in the environment before installation, and only then use the go env GOROOT command to initialize the GOROOT_BOOTSTRAP variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant