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
x/pkgsite: use moduleID in getPackagesInUnit #45854
Comments
Hi. I'll try this issue! |
May I ask you one question? And this method doesn't use module_id. So I can not replace the argument of getPackagesInUnit to use module_id. |
Thanks @junjunjunk!
Yup! I would add a new function. You can share a lot of the same logic between the two functions, so it might be helpful to know that we use https://pkg.go.dev/github.com/Masterminds/squirrel to create shared queries in our codebase. https://github.com/golang/pkgsite/blob/dfa0f1976413309fde70a10909a49793da16725b/internal/postgres/symbol_history.go#L62 is an example of a place where squirrel is used. |
Thank you for your thoughtful response! |
Add argument moduleID to getPackagesInUnit for more efficiency. Fixes golang/go#45854
Add argument moduleID to getPackagesInUnit for more efficiency. Fixes golang/go#45854
Change https://golang.org/cl/315489 mentions this issue: |
getPackagesInUnit is used by the frontend via getUnitWithAllFields.
Since we can easily get the moduleID from the first query in that function, we should consider passing in the moduleID to getPackagesInUnit instead of (modulePath, version). This could increase performance since we no longer need to JOIN on the modules table and can filter by
u.module_id
.The text was updated successfully, but these errors were encountered: