buildtools
buildtools copied to clipboard
Adding "Compact Constants" Option
- Adding
CompactConstantDefinitions
boolean flag totables/tables.go
.- Can be set via tables json file (
--add_tables
/--tables
command line ortables
/addTables
json config option). - Defaulting to
false
to be backwards-compatible with existing formatted files.
- Can be set via tables json file (
- Updating
compactStmt()
inbuild/print.go
.- If
CompactConstantDefinitions
is true and both statements are assignments (for const definitions), then the extra line should be removed. - Lower precedence than various other checks (like comment checks) to still allow extra lines when necessary.
- If
- Updating
setFlags()
inbuild/print_test.go
.- Checking golden filenames for ".compactconst." to set
CompactConstantDefinitions
to true. - Adding
CompactConstantDefinitions
reset back to false in returned (deferred) func.
- Checking golden filenames for ".compactconst." to set
- Copying various golden files (which contain constant definitions) to be ".compactconst." files.
- Removing extra lines between const definitions as applicable.
Fixes https://github.com/bazelbuild/buildtools/issues/108.
Hi, I'm not sure if I'm missing any step to get the review started? If there's something I missed, or if there's any desired changes, please let me know. Thanks!