Open fishy opened 3 years ago
Yeah this bug is annoying to me as well. Thanks a lot for raising it.
I am not sure if this should be resolved by gazelle or as a formatting directive in buildifier. Or both. 🤔
Currently instead of rewriting the entire macro like you are using in https://github.com/reddit/baseplate.go/pull/402/, I would just run a range sed
with pattern like '/^$/d'
and then run buildifier again to format the starlark file.
What version of gazelle are you using?
v0.23.0
What version of rules_go are you using?
v0.26.0
What version of Bazel are you using?
4.1.0
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
linux/amd64
What did you do?
This is a "minimal" example:
go.mod
file:main.go
file:WORKSPACE
file:BUILD.bazel
file:initial
external.bzl
file:Run the following commands:
At this point,
external.bzl
file is auto populated like this, with no extra blank lines betweengo_repository
:Now upgrade the dependency to cause new dependencies being pulled in:
Some of the
go_repository
is removed fromexternal.bzl
, and some of the newgo_repository
is added, but after every block of addedgo_repository
there's an extra blank line, for example:(
com_github_cloudykit_jet_v3
is a new dependency added by the module upgrade, replacing the oldcom_github_cloudykit_jet
)What did you expect to see?
gazelle being consistent regarding the blank lines between
go_repository
s.What did you see instead?