goland 解决 cannot resolve directory 'xxxx'问题


发现问题

今天好好的项目突然就好多依赖标红了,go.mod 也全是红的,但是执行 go mod tidysh build.sh 都没有问题,但是看到标红就浑身难受,自己捣鼓了一通,发现没啥用,最后发现了 cannot resolve directory 'gocarina' 这个报错,抱着死马当活马医的心态上某度搜了一下,发现了不少解决方案。

goland 解决 cannot resolve directory 'xxxx'问题

goland 解决 cannot resolve directory 'xxxx'问题
图源:解决cannot resolve directory问题

原因

原因是Goland 编辑器中项目设置为 go modules 项目,导致从gomod读取,从而飘红

解决方案

点击 Goland -> Perferences -> Go -> Go modules,勾选上 Enable Go modules integration,依次点击 「Apply」和 「OK」,马上就恢复正常了。

goland 解决 cannot resolve directory 'xxxx'问题

参考:解决cannot resolve directory问题

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/289526.html

(0)
上一篇 2022年9月14日 23:38
下一篇 2022年9月14日 23:38

相关推荐

发表回复

登录后才能评论