bazel-contrib / bazel-contrib/buildtools

Buildozer add "rename_if_exist"

Open
#1,166 2 comments 0 reactions 0 assignees View on GitHub
P3
Dominant language
Go
Stars
1.2k
Forks
471
Avg merge
2d 22h
Merged PRs (30d)
13

Description

Would be great if there was a rename which doesn't error out when attr doesn't exist.

Current workaround:
```
set_if_absent old_attr INVALID
rename old_attr new_attr # NOTE errors out if old_attr is not set
remove_if_equal new_attr INVALID
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing rename command and its tests in the Buildozer codebase, then read how it handles a missing attribute. Define the new rename_if_exist behavior from the request and its workaround, and add coverage showing that an absent old_attr does not error while an existing attribute is renamed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system, cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.