Go's Confusing Version Output
In Go, using the go version command can sometimes yield unexpected results. Instead of displaying the installed Go version, it may indicate an "xgcc" version. This discrepancy can be perplexing, especially when the installed version is known to be different.
To understand this issue, it's important to know that many Linux distributions include Go through their package managers, such as APT. However, this often installs a version of Go that's compiled with GCC, known as "xgcc". This xgcc version may differ from the one installed from the official Go tarball, which uses the Clang compiler.
In your case, you've installed Go 1.4.2 from the tarball. However, your system still has the xgcc version installed through APT. To resolve this, you can remove the xgcc version using the following command:
sudo apt-get remove gccgo
After removing the xgcc version, running go version should now display the correct installed version of Go, which in your case is 1.4.2.
The above is the detailed content of Why Does `go version` Show an 'xgcc' Version Instead of My Installed Go Version?. For more information, please follow other related articles on the PHP Chinese website!