fix(json)!: correct spelling of JSONDefaultIndent (#7)

Fix misspelled variable name `JSONDefualtIndent` to `JSONDefaultIndent`
throughout the codebase. Update documentation to reference this
correctly spelled variable in the JSON struct's Indent field comment.

BREAKING CHANGE: Rename `JSONDefualtIndent` to correctly spelled `JSONDefaultIndent`.
This commit is contained in:
2025-06-11 02:25:51 +01:00
committed by GitHub
parent 2fb5fea7fb
commit e85261d0c6

View File

@@ -6,9 +6,9 @@ import (
"io" "io"
) )
// JSONDefualtIndent is the default indentation string used by JSON instances // JSONDefaultIndent is the default indentation string used by JSON instances
// when pretty rendering if no Indent value is set on the JSON instance itself. // when pretty rendering if no Indent value is set on the JSON instance itself.
var JSONDefualtIndent = " " var JSONDefaultIndent = " "
// JSON is a Handler that marshals values to JSON. // JSON is a Handler that marshals values to JSON.
type JSON struct { type JSON struct {
@@ -17,7 +17,7 @@ type JSON struct {
Prefix string Prefix string
// Indent is the string added to each level of indentation when pretty // Indent is the string added to each level of indentation when pretty
// rendering. If empty, two spaces will be used instead. // rendering. If empty, JSONDefaultIndent will be used.
Indent string Indent string
} }
@@ -43,7 +43,7 @@ func (jr *JSON) RenderPretty(w io.Writer, v any) error {
prefix := jr.Prefix prefix := jr.Prefix
indent := jr.Indent indent := jr.Indent
if indent == "" { if indent == "" {
indent = JSONDefualtIndent indent = JSONDefaultIndent
} }
enc := json.NewEncoder(w) enc := json.NewEncoder(w)