encoding/prototext: drop trailing newline for empty
This is more consistent with the indent documentation:
If indent is a non-empty string, it causes every entry in a List or Message
to be preceded by the indent and trailed by a newline.
Since an empty message has no entries, there should be no newlines.
Change-Id: I5d57165aaf94ca6b184bb35bf05d5d68f5ee9dd5
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/194877
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/encoding/text/text_test.go b/internal/encoding/text/text_test.go
index 64771f3..ba08868 100644
--- a/internal/encoding/text/text_test.go
+++ b/internal/encoding/text/text_test.go
@@ -42,7 +42,7 @@
}{{
in: "",
wantVal: V(Msg{}),
- wantOutIndent: "\n",
+ wantOutIndent: "",
}, {
in: S("%s# hello%s", space, space),
wantVal: V(Msg{}),