Why Does `go version` Show xgcc Instead of My Installed Go 1.4.2?

DDD
Release: 2024-11-19 08:32:02
Original
240 people have browsed it

Why Does `go version` Show xgcc Instead of My Installed Go 1.4.2?

Discrepancy in Go Version Display

When executing go version, you encounter a discrepancy where it prints the xgcc version instead of the installed Go version, which is 1.4.2. This issue arises despite installing Go from the latest source tar version.

Cause

The cause of this issue is the presence of multiple installed versions of Go. It appears that you have both the version installed from the Ubuntu package manager (xgcc) and the version you installed from the source tar (1.4.2).

Resolution

To resolve this issue, you need to remove the older version of Go (xgcc). Follow these steps:

  1. Open a terminal and enter the following command:
sudo apt-get remove gccgo
Copy after login

This command will remove the gccgo package, which includes the xgcc version of Go.

  1. After removing the older version, verify that go version now prints the correct version (1.4.2).

Other Considerations

If you still encounter issues, you can try the following:

  • Ensure that the $GOPATH environment variable is set correctly.
  • Check the value of the $GOROOT environment variable. It should point to the location of your installed Go version (e.g., /home/user/go).
  • Update your $PATH variable to include the path to the installed Go version's bin directory (e.g., /home/user/go/bin).

The above is the detailed content of Why Does `go version` Show xgcc Instead of My Installed Go 1.4.2?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template