bazel-contrib / bazel-contrib/rules_go
Fill in missing fields when retrieving providers
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
Adding a field to a provider is a breaking change for rules intended to be compatible with rules_go. However, we need to do this frequently when adding new features and fixing bugs.
Adding a field to a struct in Go is much less disruptive, since zero values are usually meaningful and useful. Starlark doesn't have that, but we could access provider fields with `getattr` and a default value.
A better option might be to access providers through getter functions that rebuild providers when fields are missing. We already have some of these functions like `get_archive` to deal with the aspect. Those functions could check if any field is missing, and create a new provider object with default values for those fields if so.
This would be a frequent operation, so if this has a measurable analysis performance impact, it may not be worth doing.
Contributor guide
Research direction
Start by reading the existing get_archive function and other provider getter functions mentioned in the issue. Define how missing provider fields should receive defaults while preserving rules_go compatibility, then measure analysis performance to determine whether the approach is acceptable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100