Home >Backend Development >Golang >Why Does \'go tool: no such tool \'compile\'\' Appear After Manually Installing Go on Ubuntu?
Troubleshooting "go tool: no such tool "compile"
Encountering the error "go tool: no such tool "compile"" when building a Go project can be perplexing, especially when the environment had been working properly before. This issue often arises on Ubuntu systems after installing Go directly by downloading the tar.gz file instead of using apt-get.
Potential Cause:
Installing godoc using sudo apt-get install golang-doc can potentially conflict with the manually installed Go version, leading to a discrepancy in the GOROOT environment variable.
Solution:
To resolve this issue, explicitly set the GOROOT environment variable to the path of the manually installed Go directory using the following command:
export GOROOT="/usr/local/go"
Additional Information:
The above is the detailed content of Why Does \'go tool: no such tool \'compile\'\' Appear After Manually Installing Go on Ubuntu?. For more information, please follow other related articles on the PHP Chinese website!