我有问题不允许导入周期它出现在我尝试测试我的控制器时。这是输出:can't load package: import cycle not allowedpackage project/controllers/account imports project/controllers/base imports project/components/mux imports project/controllers/accountimport cycle not allowedpackage project/controllers/account imports project/controllers/base imports project/components/mux imports project/controllers/accountimport cycle not allowedpackage project/controllers/account imports project/controllers/base imports project/components/mux imports project/controllers/routes imports project/controllers/base我如何阅读或理解此错误?依赖哪里错了?
3 回答
翻过高山走不出你
TA贡献1875条经验 获得超3个赞
这是您的第一个导入周期问题的说明。
project/controllers/account
^ \
/ \
/ \
/ \/
project/components/mux <--- project/controllers/base
你可以用我的坏ASCII图看,你是当创建导入周期project/components/mux进口project/controllers/account。由于 Go 不支持循环依赖,因此import cycle not allowed在编译时会出现错误。
- 3 回答
- 0 关注
- 178 浏览
添加回答
举报
0/150
提交
取消