6

如何限制 go 代码引用模块的目录?

 1 year ago
source link: https://www.v2ex.com/t/862236
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

如何限制 go 代码引用模块的目录?

  sadfQED2 · 9 小时 32 分钟前 via Android · 898 次点击
一个 mvc 结构的 go 语言项目,正常情况下应该是 controller 层调用 service ,service 调用 model

但是,总有一些屌毛,可能由于紧急情况,可能是懒,在偶尔周末加班等没人 CR 的时候,controller 层调其他 controller 里面的方法,controller 也在调 model 方法。偶尔还他妈 model 调 contrller 代码。刚开始可能就一两处这样写,但是后续的人改这种代码,也只能接着这样写。最终项目崩塌,成为真正的屎山。

很多年前,我在另外一家公司写 php 的时候,我记得当时项目是对代码引用做了限制,如果写出上面这样乱引用代码,提交的时候直接被拒。想请问一下 go 语言里面能否加这种配置呢?在哪加?知道的麻烦给个关键词吧

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK