Updated on 2024-03-04 GMT+08:00

Environment Variables Are Not Configured

Symptoms

"Unable to start the Go service, please configure Go environment variables!" is displayed, prompting you to configure the environment variable.

Analysis

  1. Go is not installed.
  2. Environment variables are not configured or are incorrectly configured.

Solution

  1. If Go is not installed, install it by following the instructions provided in Installing Go.
  2. Configure the environment variables correctly.

    The current startup and stop operations are performed in no_login mode. If the operating system is Linux and Go is manually installed, add environment variables to the following files:

    • Ubuntu: ~/.bashrc and ~/.profile
    • Centos: ~/.bashrc and ~/.bash_profile

    The following is a configuration example of the environment variables:

    • export GOROOT=/usr/local/go/go_install_dir/go
    • export GOPATH=/usr/local/go/go_workpath
    • export PATH= $GOROOT/bin:$PATH

Starting/Stopping Go Service FAQs

more