mirror of
https://github.com/golang/go.git
synced 2025-10-19 11:03:18 +00:00
all: replace reflect.Value.Type.Kind with reflect.Value.Kind
Fixes #46107 Change-Id: I170f3cacda652752cd740e04b565a616a0e43fd1 Reviewed-on: https://go-review.googlesource.com/c/go/+/632635 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
82337de9f2
commit
439d39a719
4 changed files with 5 additions and 5 deletions
|
@ -67,14 +67,14 @@ func typefix(f *ast.File, badType func(string) bool) bool {
|
|||
return
|
||||
}
|
||||
v := reflect.ValueOf(n)
|
||||
if v.Type().Kind() != reflect.Pointer {
|
||||
if v.Kind() != reflect.Pointer {
|
||||
return
|
||||
}
|
||||
if v.IsNil() {
|
||||
return
|
||||
}
|
||||
v = v.Elem()
|
||||
if v.Type().Kind() != reflect.Struct {
|
||||
if v.Kind() != reflect.Struct {
|
||||
return
|
||||
}
|
||||
for i := 0; i < v.NumField(); i++ {
|
||||
|
|
|
@ -199,7 +199,7 @@ func (dec *Decoder) Decode(e any) error {
|
|||
value := reflect.ValueOf(e)
|
||||
// If e represents a value as opposed to a pointer, the answer won't
|
||||
// get back to the caller. Make sure it's a pointer.
|
||||
if value.Type().Kind() != reflect.Pointer {
|
||||
if value.Kind() != reflect.Pointer {
|
||||
dec.err = errors.New("gob: attempt to decode into a non-pointer")
|
||||
return dec.err
|
||||
}
|
||||
|
|
|
@ -662,7 +662,7 @@ func (enc *Encoder) encode(b *encBuffer, value reflect.Value, ut *userTypeInfo)
|
|||
for i := 0; i < indir; i++ {
|
||||
value = reflect.Indirect(value)
|
||||
}
|
||||
if ut.externalEnc == 0 && value.Type().Kind() == reflect.Struct {
|
||||
if ut.externalEnc == 0 && value.Kind() == reflect.Struct {
|
||||
enc.encodeStruct(b, engine, value)
|
||||
} else {
|
||||
enc.encodeSingle(b, engine, value)
|
||||
|
|
|
@ -280,7 +280,7 @@ func (d *Decoder) unmarshalAttr(val reflect.Value, attr Attr) error {
|
|||
}
|
||||
}
|
||||
|
||||
if val.Type().Kind() == reflect.Slice && val.Type().Elem().Kind() != reflect.Uint8 {
|
||||
if val.Kind() == reflect.Slice && val.Type().Elem().Kind() != reflect.Uint8 {
|
||||
// Slice of element values.
|
||||
// Grow slice.
|
||||
n := val.Len()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue