Install idelite, configure the environment according to the tutorial, run the first go program: (go installed in the root directory of drive C, GOPATH in the root directory of drive D)

Go mod is an official package dependency management tool introduced in Golang version 1.11. It is used to solve the problem that there is no local record of the specific version of the dependency package before, so as to facilitate the management of dependency packages.

Golang provides an environment variable, GO111MODULE, which has three optional values: off, ON, and auto (the default).

Off: GOPATH mode to find vendor and GOPATH directories

On: module-aware mode, use go Module, ignore GOPATH directory

Auto: Use GO111MODULE if the current directory is not $GOPATH and there is a go.mod file in the current directory (or parent directory), otherwise use GOPATH Mode.

So go to Settings and find a tool to manage GOPATH/Modules

To customize GO11MODUKE as Auto, click Apply

Run the application again and it will work fine:

Reference: blog.csdn.net/kevinh531/a…