当前位置:网站首页>Easycvr development environment startup program reports an error import cycle not allowed solution

Easycvr development environment startup program reports an error import cycle not allowed solution

2022-06-24 06:06:00 Tsingsee green rhino video

We are in the EasyCVR When developing , An error is reported in the development environment startup program , error message : import cycle not allowed. This error message should be written by everyone Golang A common error in the program , So this article starts from EasyCVR I will share with you how to solve this error report .

Error message means A Package call B package ,B Package call A package , Causes repeated loop calls . This error in a normal project may not be A Package call B The package is so simple , May be A Called B,B Called C,C Called A, There are multiple layers of calls , If it is a problem between two packages, it can be handled through an intermediate package , However, multiple layers cannot be handled in one tundish .

The process is roughly as follows :

A Is the framework level structure of the application , stay A Contains sub modules B and C The pointer to ;

B To facilitate the use of other sub modules of the application ( such as C ) function , So its structure contains A The pointer to ;

C To be called A A method in the package .

If this kind of multi-layer loop call occurs in the project , We will introduce a package to solve the project problems :

1. Create a new package file and import the package

2. Used in projects

3. Invoke in the project

stay EasyCVR We solve this problem through subcontracting , Of course, there are also cases that can be solved by defining interfaces , You can judge according to your own situation . If you want to know more EasyCVR Function realization during development , Welcome to follow us .

原网站

版权声明
本文为[Tsingsee green rhino video]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/07/20210726184245079Z.html