The environment variable
GOROOT indicates the Go language installation directory.
windows, the default value of
C:/go, while in macOS or Linux, the default value of
usr/local/go. If you install Go in another directory, you need to change the value of
GOROOT to the corresponding directory.
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.