bazel-contrib / rules_go

Go rules for Bazel
Apache License 2.0
1.38k stars 656 forks source link

Remove more hasattr/getattr calls in go_context #4054

Closed dzbarsky closed 1 month ago

dzbarsky commented 1 month ago

What type of PR is this? starlark cleanup

What does this PR do? Why is it needed? The current logic to grab all the providers is confusing; it runs the fallback logics even in the case when go_context_data is found. Easier to follow when we pass the data in explicitly, and a bit faster as well.

I also considered making a go_context_v2 api that doesn't have all the fallbacks and using that to power go_context, but didn't do it for now.

Which issues(s) does this PR fix?

Fixes #

Other notes for review