bazel-contrib / bazel-contrib/buildtools
[buildozer] `set` on unknown list name sets string as value
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 471
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 13
Description
If you have a rule that has a list attr that isn't known (or at least isn't just `deps`) like this:
```bzl
some_rule(
name = "foo",
something = [
"foo",
],
)
```
and you run:
```
buildozer 'set something a b' :foo
```
You end up with:
```bzl
cc_library(
name = "foo",
something = a,
)
```
Instead of:
```bzl
cc_library(
name = "foo",
something = [
"a",
"b",
],
)
```
One potential workaround to this is to do:
```
buildozer 'remove something' 'add something a b' :foo
```
But it seems like this should work, or that there should be a `set_list` to do this
Contributor guide
Research direction
Reproduce the issue with the shown buildozer `set something a b` command on a rule whose list attribute is not `deps`, then trace the command's handling of unknown attributes. Done means the command preserves list syntax with both values, with regression coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100