Anyone know why `TargetRootsToFieldSets` needs to...
# development
w
Anyone know why
TargetRootsToFieldSets
needs to be exclusively in a
@goal_rule
rather than just a regular
@rule
?
Copy code
target_roots_to_field_sets_get = [Get(
        TargetRootsToFieldSets,
        TargetRootsToFieldSetsRequest(
            field_set_superclass=fs,
            goal_description="",
            no_applicable_targets_behavior=NoApplicableTargetsBehavior.ignore,
        ),
    ) for fs in peekable_field_sets]

    target_roots_to_field_sets = await MultiGet(target_roots_to_field_sets_get)
h
Are you referring to the
goal_description
part? It can be used anywhere. Only the
goal_description
is to make a better error message
w
No, if I try to run this from an
@rule
function, it bombs out with a ruleerror - but works fine when I run it in an
@goal_rule
https://github.com/pantsbuild/pants/pull/20331/files/a01c4f349bcdae1e4e00625f2d8a84750b634a79#r1435506639