diff options
author | 2023-06-01 22:20:16 +0100 | |
---|---|---|
committer | 2023-06-01 22:20:16 +0100 | |
commit | 55aacaf4b07c1921061245cbaa3d307e97cf3c29 (patch) | |
tree | d969c5d9728566de1e794e19c5b19d3b660f790e /vendor/github.com/goccy/go-json/internal/encoder/compiler.go | |
parent | [chore/frontend] refactor header templating, add apple-touch-icon (#1850) (diff) | |
download | gotosocial-55aacaf4b07c1921061245cbaa3d307e97cf3c29.tar.xz |
[chore]: Bump github.com/gin-gonic/gin from 1.9.0 to 1.9.1 (#1855)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/goccy/go-json/internal/encoder/compiler.go')
-rw-r--r-- | vendor/github.com/goccy/go-json/internal/encoder/compiler.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go index 3b3ff3fde..3ae39ba8c 100644 --- a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go +++ b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go @@ -617,6 +617,13 @@ func (c *Compiler) structCode(typ *runtime.Type, isPtr bool) (*StructCode, error return code, nil } +func toElemType(t *runtime.Type) *runtime.Type { + for t.Kind() == reflect.Ptr { + t = t.Elem() + } + return t +} + func (c *Compiler) structFieldCode(structCode *StructCode, tag *runtime.StructTag, isPtr, isOnlyOneFirstField bool) (*StructFieldCode, error) { field := tag.Field fieldType := runtime.Type2RType(field.Type) @@ -626,7 +633,7 @@ func (c *Compiler) structFieldCode(structCode *StructCode, tag *runtime.StructTa key: tag.Key, tag: tag, offset: field.Offset, - isAnonymous: field.Anonymous && !tag.IsTaggedKey, + isAnonymous: field.Anonymous && !tag.IsTaggedKey && toElemType(fieldType).Kind() == reflect.Struct, isTaggedKey: tag.IsTaggedKey, isNilableType: c.isNilableType(fieldType), isNilCheck: true, |