Consider using more strict formatters for Go code like gci and gofumpt

213 views
Skip to first unread message

Mateusz Gozdek

unread,
Oct 21, 2021, 4:33:52 AM10/21/21
to Prometheus Developers
Hi all,

While recently contributing for the first time to Prometheus code base, I've noticed that the Go source files could be more consistently formatted. My IDE is configured for a long time to use "gofumpt" and "gci" formatters on file save, so "git diff" was producing a lot of unrelated changes to me, which is a bit annoying if one wants to produce clean commits without mixed changes, so some "git add -p" dance was required almost all the time.

Considering that both of mentioned formatters are backward compatible with core "gofmt" and that golangci-lint supports enforcing both of them, I'd like to propose enabling those linters on the repositories.

I believe this can also resolve some possible discussions on formatting, saving time and focus on more important areas of the code.


This suggestion was originally posted here: https://github.com/prometheus/prometheus/issues/9557

Let me know what you think.

Regards,
Mateusz Gozdek


Julien Pivotto

unread,
Oct 21, 2021, 4:36:10 AM10/21/21
to Mateusz Gozdek, Prometheus Developers
I like this idea.


--
Julien Pivotto
@roidelapluie

Ben Kochie

unread,
Oct 21, 2021, 7:22:41 AM10/21/21
to Mateusz Gozdek, Prometheus Developers
+1, the formatting changes look nice.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/20211021083605.GA130008%40hydrogen.

Bartłomiej Płotka

unread,
Oct 21, 2021, 8:11:03 AM10/21/21
to Ben Kochie, Mateusz Gozdek, Prometheus Developers
+1

Help wanted to add those to our pipelines (: 

Kind Regards,
Bartek Płotka (@bwplotka)


Reply all
Reply to author
Forward
0 new messages