From 643cbc4d6e37d07619bec05039da1abb411d28d4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 7 Feb 2023 12:45:46 -0700 Subject: Move struct-handling to internal/jsonstruct --- encode.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'encode.go') diff --git a/encode.go b/encode.go index ca4e060..fa558b9 100644 --- a/encode.go +++ b/encode.go @@ -16,6 +16,8 @@ import ( "strconv" "strings" "unsafe" + + "git.lukeshu.com/go/lowmemjson/internal/jsonstruct" ) // Encodable is the interface implemented by types that can encode @@ -299,7 +301,7 @@ func encode(w *ReEncoder, val reflect.Value, escaper BackslashEscaper, quote boo return err } empty := true - for _, field := range indexStruct(val.Type()).byPos { + for _, field := range jsonstruct.IndexStruct(val.Type()).ByPos { fVal, err := val.FieldByIndexErr(field.Path) if err != nil { continue -- cgit v1.2.3-2-g168b