Home > Backend Development > Golang > How to Fix \'go tool: no such tool \'compile\'\' After Installing godoc?

How to Fix \'go tool: no such tool \'compile\'\' After Installing godoc?

DDD
Release: 2024-12-17 00:35:24
Original
468 people have browsed it

How to Fix

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
Copy after login

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!

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