-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
models should not depend on macaron #6927
Comments
This affects most of models/mail.go: Lines 47 to 119 in 6dbd261
In fact models/mail.go probably doesn't belong in models at all. There is one place in models/login_source.go that depends on macaron/binding: Line 411 in ef2a343
I suspect that this isn't the correct function and we have a different more specific check for validity of usernames. |
We should probably also look carefully at where we can dissect out macaron from modules - eg. modules/log I think depends on macaron because of the router log but this could/should be cleaned in such a way that it's moved out. In general we should try to decouple as much of models as possible, and separate modules in to two sections - those that depend on models and those that models depends on. |
@zeripath I would like to split |
|
OK so I'm wrong above. The issue appears to be resulting from dependencies on:
|
Which when looked at with a bit of a more complex script: for i in $(go list -f '{{ join .Imports "\n"}}' code.gitea.io/gitea/models); do [09:35:43]
go list -f '{{ join .Deps "\n" }}' $i |
grep "code.gitea.io/gitea/vendor/gopkg.in/macaron.v1" 1> /dev/null &&
echo "Checking: $i" 1>&2 &&
(for j in $(go list -f '{{ join .Imports "\n"}}' $i); do go list -f '{{ join .Deps "\n" }}' $j | grep "code.gitea.io/gitea/vendor/gopkg.in/macaron.v1" 1> /dev/null && echo " $j"; done)
done Results in:
Revealing that the naughty packages that independently depend on macaron are as follows:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
@zeripath I think this could be closed. |
Closed as when
|
It still does...
I think it's through modules/setting which makes it a bit difficult to remove. |
yup it's through setting. which means I guess we need to remove the dependency on macaron from setting. |
The models package dependency tree is rather complex. In particular it currently relies on and imports macaron.
This causes macaron's init to run even in gitea commands that will not run a webserver - it also prevents early mitigation of macaron's init.
We should move methods that require macaron out of models and in to routers or into modules and consider if there are other places in modules where we can avoid importing macaron.
The text was updated successfully, but these errors were encountered: