GOROOT
The environment variable GOROOT
indicates the Go language installation directory.
In windows
, the default value of GOROOT
is C:/go
, while in macOS or Linux, the default value of GOROOT
is usr/local/go
. If you install Go in another directory, you need to change the value of GOROOT
to the corresponding directory.
In addition, GOROOT/bin
contains the toolchain that Go provides for us, so you should configure GOROOT/bin
to the environment variable PATH so that we can use the Go toolchain globally.