Home >Backend Development >Golang >Why Does My `go version` Command Show the Wrong Version After Updating Go?

Why Does My `go version` Command Show the Wrong Version After Updating Go?

Susan Sarandon
Susan SarandonOriginal
2024-11-12 05:36:02911browse

Why Does My `go version` Command Show the Wrong Version After Updating Go?

go version Command Displays Incorrect Version after Update

Despite installing Go version 1.8, the go version command continues to show 1.7.5 when executed in the terminal. The user has verified the correct installation in /usr/local/go/bin but suspects an issue with their .bashrc configuration.

After examining the provided .bashrc file, it appears that Go is not explicitly set as the preferred version. To resolve this, it is recommended to add the following lines to the end of the file:

export GOROOT='/usr/local/go'  # Replace with your Go installation path
export PATH=$GOROOT/bin:$PATH

Save the changes and reload the .bashrc file by running:

source ~/.bashrc

This will ensure that the terminal recognizes the most recent Go version. However, it is important to note that the user reported using Homebrew to update Go, which is not the official installation method. To ensure a proper installation, it is advisable to download the latest Go binary from the official website.

The above is the detailed content of Why Does My `go version` Command Show the Wrong Version After Updating Go?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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