Skip to content
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

gazelle:resolve_regexp should support regex in label #1821

Closed
lkassar-stripe opened this issue Jun 5, 2024 · 4 comments · Fixed by #1822
Closed

gazelle:resolve_regexp should support regex in label #1821

lkassar-stripe opened this issue Jun 5, 2024 · 4 comments · Fixed by #1822

Comments

@lkassar-stripe
Copy link
Contributor

What version of gazelle are you using?

0.33.0

What version of rules_go are you using?

0.41.0

What version of Bazel are you using?

7.0.1

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

macOS Sonoma 14.0, arm64

Issue

Context: We maintain a large golang repository with gazelle, and we would like gazelle to manage resolution for importpaths that point to targets in an external repository that we have. Although the gazelle:repository directive exists, since it operates heuristically, the importpath doesn't match the expected target name that gazelle attempts to resolve it to.

We would like to use the gazelle:resolve_regexp to solve this. gazelle:resolve_regexp has an argument for the import-string-regexp and the label it matches to. We'd like to support the label also being a regexp, and populate that regexp with matches from the import-string-regexp.

I have a change that would do this, which I will PR after creating this issue, but would like some feedback on the possibility of supporting this in bazel-gazelle, as folks on our team have expressed that this seems intuitive change to the existing directive and would allow us the possibility to use this for many upcoming cases where we need to manipulate gazelle resolves.

@jeromep-stripe
Copy link
Contributor

@linzhp Hi again! Any chance you could evaluate this when you have a moment? @lkassar-stripe also has a PR ready.

@linzhp
Copy link
Contributor

linzhp commented Jun 11, 2024

I can take a look later this week

@negator
Copy link

negator commented Jun 27, 2024

Any updates here? Our company (vsco.co) uses gazelle heavily, however we are facing a similar issue as the OP. Namely we have some 50+ generated go_proto_library rules that are not indexable by gazelle, and which are continually updated. I.e. they are not defined statically in BUILD files. So we must use resolve annotations for each and every one. We'd like the ability to use regex captures to enable us to use a single resolve_regexp rather than many.

@linzhp
Copy link
Contributor

linzhp commented Jun 28, 2024

@tyler-french is reviewing the PR

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 a pull request may close this issue.

4 participants