bazel-contrib / bazel-contrib/buildtools

buildozer -stdout exits 0 and outputs nothing when no changes are made

Open
#1,324 1 comment 1 reaction 0 assignees View on GitHub
P4
Dominant language
Go
Stars
1.2k
Forks
471
Avg merge
2d 22h
Merged PRs (30d)
13

Description

When buildozer 8.0.0 runs fixes without the `-stdout` flag, it exits with status 3 and prints nothing when it has no changes to make. When it runs on the same BUILD file with the `-stdout` flag, it also outputs nothing to stdout and exits with status 0. This makes it ambiguous whether the output is missing because buildozer had nothing to do or because its altered output is legitimately an empty file.

My preference would be to have the `-stdout` flag always produce BUILD file content whether it was altered or not. If we need to differentiate those two cases then let's use the exit status to do that.

To reproduce this, run `buildozer -stdout 'fix unusedLoads' //:__pkg__` on this project's workspace.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `buildozer -stdout 'fix unusedLoads' //:__pkg__` on the project's workspace and compare it with the same command without `-stdout`. Trace the `-stdout` entry point and its no-change handling; done means the behavior distinguishes an unchanged BUILD file from legitimately empty altered output, with the exit status matching the chosen convention.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.