<div dir="ltr"><div><div>​Hi Team Core,<br><br><b>Context/Background:-</b><br>I am working on <a href="https://github.com/almighty/almighty-core/issues/244" target="_blank">#244</a>. The task is to do <span style="background-color:rgb(255,255,255)">`fields["system.creator"]=currentLoggedInUser</span>`.<br><br>There, I want to call a method Locate from package "Token" which returns current logged in user.<br>While doing so I am facing cyclic import problem.<br><br><b>Reason:-</b> Work_item_repo is in package "models", it wants to call Locate method from package "token".<br>But "token" pachakge imports "account" package and "account" package imports "models".<br>Hence "models" package is unable to import "token" => cyclic dependency.<br><br><b>Debugging:-</b> When I was looking into "account" package, what exactly it needs from "models" package is ONLY "models.LifeCycle" and nothing else as of now.<br><br><b>Solutions:-</b> One quick possible/feasible solution is to put models.LifeCycle into different new package of its own, refactor and move on (IMO we should do this as first step).<br><br>Another is to write a middleware(as mentioned in <a href="https://github.com/almighty/almighty-core/issues/244">#244</a>) for injecting loggedInUser which will be in package "middleware" and avoid cyclic import, <br><br>Or redesigning to decouple models package into smaller chunks ?<br></div><div><br>PFA- I have attached output of `go list -f` on account, models, token packages.<br><br>Any input on this will be helpful :)<br></div><div><br><br></div>Thanks,<br></div>Pranav<br></div>