Resolving "go tool: no such tool "compile"" Error After Installing godoc
After installing godoc using sudo apt-get install golang-doc, a developer encounters the aforementioned error when attempting to build a project with go build. The error stems from the potential installation of an incorrect version of the Go toolchain.
Resolution
The issue can be resolved by setting the GOROOT environment variable. This variable points to the root directory of the Go installation, which contains the toolchain.
To set the GOROOT variable, execute the following command in the terminal:
export GOROOT=/usr/local/go
Replace /usr/local/go with the actual path to your Go installation.
This command will assign the correct path to GOROOT, ensuring that the system can locate the compile tool and execute the build process successfully.
The above is the detailed content of How to Fix \'go tool: no such tool \'compile\'\' After Installing godoc?. For more information, please follow other related articles on the PHP Chinese website!