go module使用教程:使用go mod的方法.报错go: cannot determine module path for source directory

使用go mod的方法

单独从大工程里拷出小文件想新建新文件工程时,部分文件路径名报红,出现报错
go: cannot determine module path for source directory E:\tttttt (outside GOPATH, no import comments)
1.在src 目录下新建 go.mod文件
2. go.mod中第一行加入一行内容 module src
3.goland中 file->Settings->Go->Go Modules中勾上 Enable Go Modules(vgo) integration

右键src目录,以goland工程打开,报红消失
————————————————
版权声明:本文为CSDN博主「小白debug」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ilini/article/details/88398744

posted on 2021-10-18 20:05  ExplorerMan  阅读(1499)  评论(0编辑  收藏  举报

导航