fix: use label for robustness#556
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
|
@a-zw can you explain why this is better? |
He specified this in another chat:
|
|
So the argument is |
|
@MaximilianSoerenPollak I added that to the description (assuming that it ends up in the merge commit). @AlexanderLanin It is not about readability but about robustness. If we rename the module, Label just keeps working. If someone renames the module when importing it, Label just keeps working. It is not a critical thing because I don't see any of these things happening in the near future. It looks like a good practice though. |
It links to this PR anyway, so thats fine. |
📌 Description
Label()is the best way to specify targets "relative to lexically-here". For contrast, something like "//foo:bar" is "relative to dynamically-here" and fails if one executes rules from another module. It is mostly equivalent to "@my_module//foo:bar" but avoids repeating the current module name. It also works when module names are remapped (but afaik nobody does that yet in S-CORE).Also, fix two occasions where code might break if labels are involved.
See https://bazel.build/rules/lib/builtins/Label for context.
🚨 Impact Analysis
✅ Checklist