From 36dc84ca5738e5aa03814dba4c439a0d823a1fa9 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Mon, 14 Aug 2023 11:53:26 +0000 Subject: [PATCH] encoding/json: declare hex as a const hex is in fact immutable, declare it as a const to avoid accidental modification, also for consistency with other packages. Change-Id: I99f292e98c82d4c4526e46c9897d154d0c073da5 GitHub-Last-Rev: d2f06965e7e03df470d8c3c8882619187abf1609 GitHub-Pull-Request: golang/go#62011 Reviewed-on: https://go-review.googlesource.com/c/go/+/519155 Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov --- src/encoding/json/encode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go index a98f1a060c..536ec21f4f 100644 --- a/src/encoding/json/encode.go +++ b/src/encoding/json/encode.go @@ -245,7 +245,7 @@ func (e *MarshalerError) Error() string { // Unwrap returns the underlying error. func (e *MarshalerError) Unwrap() error { return e.Err } -var hex = "0123456789abcdef" +const hex = "0123456789abcdef" // An encodeState encodes JSON into a bytes.Buffer. type encodeState struct { -- 2.50.0