瀏覽代碼

vendor: github.com/hashicorp/go-msgpack v0.5.5 (indirect)

updating to the latest v0.5.x patch release:

full diff: https://github.com/hashicorp/go-msgpack/compare/v0.5.3...v0.5.5

- Fix an issue where struct pointer fields tagged with omitempty will be omitted
  if referenced value is empty, so a field of type *bool, then field would be
  omitted pointer is nil or &false.
- Fixed a decoding issue when decoding a string value in a map where the value
  already existed would panic.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 年之前
父節點
當前提交
421b93dcf5

+ 1 - 1
vendor.mod

@@ -120,7 +120,7 @@ require (
 	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
 	github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
 	github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
 	github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
 	github.com/hashicorp/errwrap v1.1.0 // indirect
 	github.com/hashicorp/errwrap v1.1.0 // indirect
-	github.com/hashicorp/go-msgpack v0.5.3 // indirect
+	github.com/hashicorp/go-msgpack v0.5.5 // indirect
 	github.com/hashicorp/go-multierror v1.1.1 // indirect
 	github.com/hashicorp/go-multierror v1.1.1 // indirect
 	github.com/hashicorp/go-sockaddr v1.0.2 // indirect
 	github.com/hashicorp/go-sockaddr v1.0.2 // indirect
 	github.com/hashicorp/golang-lru v0.5.4 // indirect
 	github.com/hashicorp/golang-lru v0.5.4 // indirect

+ 2 - 1
vendor.sum

@@ -614,8 +614,9 @@ github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJ
 github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
 github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
 github.com/hashicorp/go-memdb v1.3.2 h1:RBKHOsnSszpU6vxq80LzC2BaQjuuvoyaQbkLTf7V7g8=
 github.com/hashicorp/go-memdb v1.3.2 h1:RBKHOsnSszpU6vxq80LzC2BaQjuuvoyaQbkLTf7V7g8=
 github.com/hashicorp/go-memdb v1.3.2/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g=
 github.com/hashicorp/go-memdb v1.3.2/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g=
-github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4=
 github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
 github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
+github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
 github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
 github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
 github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
 github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
 github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
 github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=

+ 1 - 1
vendor/github.com/hashicorp/go-msgpack/codec/decode.go

@@ -527,7 +527,7 @@ func (f *decFnInfo) kMap(rv reflect.Value) {
 			}
 			}
 		}
 		}
 		rvv := rv.MapIndex(rvk)
 		rvv := rv.MapIndex(rvk)
-		if !rvv.IsValid() {
+		if !rvv.IsValid() || !rvv.CanSet() {
 			rvv = reflect.New(vtype).Elem()
 			rvv = reflect.New(vtype).Elem()
 		}
 		}
 
 

+ 7 - 0
vendor/github.com/hashicorp/go-msgpack/codec/helper.go

@@ -45,6 +45,13 @@ const (
 	// for debugging, set this to false, to catch panic traces.
 	// for debugging, set this to false, to catch panic traces.
 	// Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic.
 	// Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic.
 	recoverPanicToErr = true
 	recoverPanicToErr = true
+
+	// if checkStructForEmptyValue, check structs fields to see if an empty value.
+	// This could be an expensive call, so possibly disable it.
+	checkStructForEmptyValue = false
+
+	// if derefForIsEmptyValue, deref pointers and interfaces when checking isEmptyValue
+	derefForIsEmptyValue = false
 )
 )
 
 
 type charEncoding uint8
 type charEncoding uint8

+ 9 - 4
vendor/github.com/hashicorp/go-msgpack/codec/helper_internal.go

@@ -33,8 +33,10 @@ func panicValToErr(panicVal interface{}, err *error) {
 	return
 	return
 }
 }
 
 
-func isEmptyValueDeref(v reflect.Value, deref bool) bool {
+func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
 	switch v.Kind() {
 	switch v.Kind() {
+	case reflect.Invalid:
+		return true
 	case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
 	case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
 		return v.Len() == 0
 		return v.Len() == 0
 	case reflect.Bool:
 	case reflect.Bool:
@@ -50,18 +52,21 @@ func isEmptyValueDeref(v reflect.Value, deref bool) bool {
 			if v.IsNil() {
 			if v.IsNil() {
 				return true
 				return true
 			}
 			}
-			return isEmptyValueDeref(v.Elem(), deref)
+			return hIsEmptyValue(v.Elem(), deref, checkStruct)
 		} else {
 		} else {
 			return v.IsNil()
 			return v.IsNil()
 		}
 		}
 	case reflect.Struct:
 	case reflect.Struct:
+		if !checkStruct {
+			return false
+		}
 		// return true if all fields are empty. else return false.
 		// return true if all fields are empty. else return false.
 
 
 		// we cannot use equality check, because some fields may be maps/slices/etc
 		// we cannot use equality check, because some fields may be maps/slices/etc
 		// and consequently the structs are not comparable.
 		// and consequently the structs are not comparable.
 		// return v.Interface() == reflect.Zero(v.Type()).Interface()
 		// return v.Interface() == reflect.Zero(v.Type()).Interface()
 		for i, n := 0, v.NumField(); i < n; i++ {
 		for i, n := 0, v.NumField(); i < n; i++ {
-			if !isEmptyValueDeref(v.Field(i), deref) {
+			if !hIsEmptyValue(v.Field(i), deref, checkStruct) {
 				return false
 				return false
 			}
 			}
 		}
 		}
@@ -71,7 +76,7 @@ func isEmptyValueDeref(v reflect.Value, deref bool) bool {
 }
 }
 
 
 func isEmptyValue(v reflect.Value) bool {
 func isEmptyValue(v reflect.Value) bool {
-	return isEmptyValueDeref(v, true)
+	return hIsEmptyValue(v, derefForIsEmptyValue, checkStructForEmptyValue)
 }
 }
 
 
 func debugf(format string, args ...interface{}) {
 func debugf(format string, args ...interface{}) {

+ 1 - 1
vendor/modules.txt

@@ -417,7 +417,7 @@ github.com/hashicorp/go-immutable-radix
 # github.com/hashicorp/go-memdb v1.3.2
 # github.com/hashicorp/go-memdb v1.3.2
 ## explicit; go 1.12
 ## explicit; go 1.12
 github.com/hashicorp/go-memdb
 github.com/hashicorp/go-memdb
-# github.com/hashicorp/go-msgpack v0.5.3
+# github.com/hashicorp/go-msgpack v0.5.5
 ## explicit
 ## explicit
 github.com/hashicorp/go-msgpack/codec
 github.com/hashicorp/go-msgpack/codec
 # github.com/hashicorp/go-multierror v1.1.1
 # github.com/hashicorp/go-multierror v1.1.1