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

feature request: Add support for generated rules to return into a *bzl.Ident #1981

Open
mclarke47 opened this issue Nov 15, 2024 · 0 comments

Comments

@mclarke47
Copy link
Contributor

mclarke47 commented Nov 15, 2024

What version of gazelle are you using?

0.39.1

What version of rules_go are you using?

Latest: 0.50.1

What version of Bazel are you using?

7.1.2

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

Yes

What operating system and processor architecture are you using?

All

What did you do?

When extending gazelle, trying to return a macro result into a bazel identifier, like so:

someValue = some_rule(
    name="name1"
)

some_other_rule(
   name="name2"
   value=someValue
)

Doing the following generated the rules as desired:

r := rule.NewRule("someValue  = some_other_rule", "name1")
r2 := rule.NewRule("some_other_rule", "name2")
r2.SetAttr("value", &bzl.Ident{
	Name: "someValue",
})

However auotmating inclusion of the import no longer works, likely since the rule kind no longer matches the import section.

What did you expect to see?

It would be great to have something like:

r2 := rule.NewRule("some_other_rule", "name2")
r2.SetReturnIndent(&bzl.Ident{
	Name: "someValue",
})

Which would allow the import to generate correctly.

What did you see instead?

The import does not generate correctly since it not longer matches the result of the import function.

Am willing to contribute with guidance!

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

No branches or pull requests

1 participant