| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
encoding/json/jsontext: clarify safety of AvailableBuffer
The current wording makes it sound like the buffer itself is unsafe, but
this is just trying to warn that manually constructing a Value is
error-prone.
For #71497.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[release-branch.go1.27] encoding/json/jsontext: clarify safety of AvailableBuffer
The current wording makes it sound like the buffer itself is unsafe, but
this is just trying to warn that manually constructing a Value is
error-prone.
For #71497.
Change-Id: I12ab3ea4e858860f8a241c514a883d376a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/811780
Reviewed-by: Jonathan Amsterdam <j...@google.com>
Reviewed-by: Damien Neil <dn...@google.com>
LUCI-TryBot-Result: golang...@luci-project-accounts.iam.gserviceaccount.com <golang...@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 35a7a64d0fef48dadd0af07c1f8e6f46ec770bc0)
diff --git a/src/encoding/json/jsontext/encode.go b/src/encoding/json/jsontext/encode.go
index 116e150..047b00a 100644
--- a/src/encoding/json/jsontext/encode.go
+++ b/src/encoding/json/jsontext/encode.go
@@ -913,9 +913,9 @@
// b = append(b, '"')
// ... := e.WriteValue(b)
//
-// WriteValue expects a JSON value. Using AvailableBuffer to manually construct
-// a value requires caution to avoid producing an invalid JSON value that would
-// then cause WriteValue to fail.
+// Note that WriteValue expects a valid JSON value. Constructing a value in a
+// raw []byte requires more care than using constructor functions like
+// [String], which always return valid [Token]s or [Value]s.
func (e *Encoder) AvailableBuffer() []byte {
// NOTE: We don't return e.Buf[len(e.Buf):cap(e.Buf)] since WriteValue would
// need to take special care to avoid mangling the data while reformatting.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |