不允许导入周期

我有问题


不允许导入周期


它出现在我尝试测试我的控制器时。这是输出:


can't load package: import cycle not allowed

package project/controllers/account

    imports project/controllers/base

    imports project/components/mux

    imports project/controllers/account

import cycle not allowed

package project/controllers/account

    imports project/controllers/base

    imports project/components/mux

    imports project/controllers/account

import cycle not allowed

package project/controllers/account

    imports project/controllers/base

    imports project/components/mux

    imports project/controllers/routes

    imports project/controllers/base

我如何阅读或理解此错误?依赖哪里错了?


红糖糍粑
浏览 179回答 3
3回答

翻过高山走不出你

这是您的第一个导入周期问题的说明。&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; project/controllers/account&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;project/components/mux <--- project/controllers/base&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;你可以用我的坏ASCII图看,你是当创建导入周期project/components/mux进口project/controllers/account。由于 Go 不支持循环依赖,因此import cycle not allowed在编译时会出现错误。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go