导入包时写的src下的绝对包路径报错
来源:4-2 包和封装

hzyhan
2019-12-24
导入本地src文件下的PR/tree包时候报错:build command-line-arguments: cannot load PR/tree: malformed module path “PR/tree”: missing dot in first path element
写回答
1回答
-
ccmouse
2019-12-25
在go.mod中,第一行有module XXX,那么我们的import路径就必须为XXX/<相对于go.mod的相对路径>
比如在我的示例代码中,是module imooc.com/ccmouse/learngo
tree在lang/tree目录下,那么就是import imooc.com/ccmouse/learngo/lang/tree
https://git.imooc.com/coding-180/coding-180/src/master/lang/tree/treeentry/entry.go#L6
00
相似问题