mirror of
https://github.com/kubernetes/sample-controller.git
synced 2026-02-15 00:07:52 +08:00
Automatic merge from submit-queue. Manually cherrypick #65034 to 1.10 Manually cherrypicking #65034. Using hack/cherry_pick_pull.sh to cherrypick is difficult because that requires cherrypicking #63059 first. This PR imported the latest jsoniterator library so that case sensitivity during unmarhsaling is optional. The PR also set Kubernetes json serializer to be case sensitive. Fix #64612. ```release-notes Kubernetes json deserializer is now case-sensitive to restore compatibility with pre-1.8 servers. If your config files contains fields with wrong case, the config files will be now invalid. ``` Kubernetes-commit: 32ac1c9073b132b8ba18aa830f46b77dcceb0723
83 lines
1.3 KiB
Go
83 lines
1.3 KiB
Go
package jsoniter
|
|
|
|
import "fmt"
|
|
|
|
type invalidAny struct {
|
|
baseAny
|
|
err error
|
|
}
|
|
|
|
func newInvalidAny(path []interface{}) *invalidAny {
|
|
return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)}
|
|
}
|
|
|
|
func (any *invalidAny) LastError() error {
|
|
return any.err
|
|
}
|
|
|
|
func (any *invalidAny) ValueType() ValueType {
|
|
return InvalidValue
|
|
}
|
|
|
|
func (any *invalidAny) MustBeValid() Any {
|
|
panic(any.err)
|
|
}
|
|
|
|
func (any *invalidAny) ToBool() bool {
|
|
return false
|
|
}
|
|
|
|
func (any *invalidAny) ToInt() int {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToInt32() int32 {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToInt64() int64 {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToUint() uint {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToUint32() uint32 {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToUint64() uint64 {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToFloat32() float32 {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToFloat64() float64 {
|
|
return 0
|
|
}
|
|
|
|
func (any *invalidAny) ToString() string {
|
|
return ""
|
|
}
|
|
|
|
func (any *invalidAny) WriteTo(stream *Stream) {
|
|
}
|
|
|
|
func (any *invalidAny) Get(path ...interface{}) Any {
|
|
if any.err == nil {
|
|
return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)}
|
|
}
|
|
return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)}
|
|
}
|
|
|
|
func (any *invalidAny) Parse() *Iterator {
|
|
return nil
|
|
}
|
|
|
|
func (any *invalidAny) GetInterface() interface{} {
|
|
return nil
|
|
}
|