使用GoLand IDE开发Go语言项目时,我从github.com下载了一些依赖项,都已经下载成功并正确导入,执行go mod tidy命令也没有问题,但GoLand却报错说:Cannot resolve directory ‘github.com’。
解决方法是,打开设置->Go->Go Modules面板,勾选Enable Go modules integration

如果未勾选,这就是问题根源。
参考
https://www.cnblogs.com/xwxz/p/13473996.html
https://blog.csdn.net/dengyuelin/article/details/117225075
https://blog.csdn.net/weixin_44024220/article/details/105960432