Skip to content

refactor(gazelle) Export module as a public struct #2959

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yushan26
Copy link

@yushan26 yushan26 commented Jun 5, 2025

Export the module struct to make it publicly accessible. This allows other py extensions to leverage the Python resolver logic for resolving Python imports, instead of have to duplicate the resolving logic.

@yushan26 yushan26 changed the title refactor(gazelle) change module into a public struct refactor(gazelle) Export module as a public struct Jun 5, 2025
@yushan26 yushan26 requested a review from rickeylev as a code owner June 5, 2025 20:29
Copy link
Collaborator

@dougthor42 dougthor42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows other py extensions to leverage the Python resolver logic

Can you elaborate on what these extensions are or might be?

TBH I'm hesitant to make any more of the gazelle go code truly public. I already am not a fan of the existing public items haha.

I'm hesitant because we don't have many maintainers for the gazelle stuff, and adding more public things means that changes need to be more careful.

I'll defer to @aignas on this, but otherwise the code changes are mostly fine. It's a very mechanical change.

@yushan26
Copy link
Author

yushan26 commented Jun 6, 2025

@dougthor42 There may be gazelle extensions that generate other macros that have python dependencies and requires resolving Python imports.
In Go, it's quite common for extensions like to reuse the Go resolver, so it would be nice to be able to use the Python resolver too, instead of duplicating the Python resolver logic.

@@ -41,7 +41,7 @@ const (

type ParserOutput struct {
FileName string
Modules []module
Modules []Module
Comments []comment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think that all of the types in this public ParserOutput type should be public if the value can be accessed, hence I think the comment should be also exposed.

Could you please do that as well? This is a non-functional change and having a git history where such refactors are grouped together may make it easier to read. Having in the CHANGELOG a line that says something like:

(gazelle) Types for exposed members of python.ParserOutput are now all public.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants