1
0
mirror of https://github.com/golang/go synced 2024-09-29 19:24:33 -06:00

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.
This commit is contained in:
Jes Cok 2023-08-14 19:03:10 +08:00
parent ac64a3628b
commit d2f06965e7

View File

@ -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 {