Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion encoding/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"reflect"
"sort"
"sync"
"time"
)

// A field represents a single field found in a struct.
Expand Down Expand Up @@ -131,7 +132,7 @@ func typeFields(t reflect.Type) []field {
}

// Record found field and index sequence.
if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct {
if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct || isPseudoType(ft) {
tagged := name != ""
if name == "" {
name = sf.Name
Expand Down Expand Up @@ -200,6 +201,10 @@ func typeFields(t reflect.Type) []field {
return fields
}

func isPseudoType(t reflect.Type) bool {
return t == reflect.TypeOf(time.Time{})
}

// dominantField looks through the fields, all of which are known to
// have the same name, to find the single field that dominates the
// others using Go's embedding rules, modified by the presence of
Expand Down