无法在 Goland 中编译简单的项目

Not able to compile simple project in Goland

在 Goland IDE 中执行一个非常简单的项目时,我看到以下错误。尝试设置 GO111MODULE=on/off/auto.. 没有任何区别!!有什么想法吗?

日志:

GOROOT=/usr/local/go #gosetup

GOPATH=/Users/<uid>/Documents/workspace/<ws_name> #gosetup
/usr/local/go/bin/go build -o /private/var/folders/jn/kjwpzfrx5f98w9nrkzkw48040000gn/T/___go_build_main_go /Users/<uid>/Documents/workspace/<project>/src/github.com/<github_id>/users-api/main.go #gosetup

main.go:4:2: no required module provides package github.com/<github_id>/users-api/app: working directory is not part of a module

Compilation finished with exit code 1

注意:uid、github_id、ws_name 等是实际 ID 的掩码

尝试执行 go mod init <your project name>

然后执行go mod tidy