TL;DR
Protocol Buffers のスキーマを整形する Buf CLI のコマンド。
例
buf format を実行すると、整形後のファイルの内容が出力される。-d を付けると差分を表示する。たとえば、メッセージの間に余分な空行がある proto ファイルでは、次のような差分が出る。
$ buf format -d
--- proto/radish/weather/v1/weather.proto.orig
+++ proto/radish/weather/v1/weather.proto
@@ -8,11 +8,6 @@
RAINY = 2;
}
-
-
-
-
-
message GetWeatherRequest {
float latitude = 1;
float longitude = 2;Visual Studio Code の拡張機能を入れると、保存時に自動で整形される。