mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-01 23:07:40 +00:00
This will
Add:
- golang.org/x/time
upgrade:
- k8s.io/client-go v8.0.0
- k8s.io/api version to kubernetes-1.11.0
- k8s.io/apimachinery version to kubernetes-1.11.0
- github.com/json-iterator/go version to latest because `https://github.com/kubernetes/kubernetes/issues/64612`
delete:
- vendor/github.com/juju/ratelimit because k8s-client-go is shifted to golang.org/x/time
Please refer: acc52496ce
```
gvt delete k8s.io/client-go
gvt delete k8s.io/api
gvt delete k8s.io/apimachinery
gvt delete github.com/json-iterator/go
gvt delete github.com/juju/ratelimit
gvt fetch --no-recurse -tag v8.0.0 k8s.io/client-go
gvt fetch --no-recurse -tag kubernetes-1.11.0 k8s.io/api
gvt fetch --no-recurse -tag kubernetes-1.11.0 k8s.io/apimachinery
gvt fetch github.com/json-iterator/go
gvt fetch golang.org/x/time
```
fixes: #3284
Signed-off-by: Satyam Zode <satyamzode@gmail.com>
124 lines
2.6 KiB
Go
124 lines
2.6 KiB
Go
package jsoniter
|
|
|
|
import (
|
|
"io"
|
|
"unsafe"
|
|
)
|
|
|
|
type numberLazyAny struct {
|
|
baseAny
|
|
cfg *frozenConfig
|
|
buf []byte
|
|
err error
|
|
}
|
|
|
|
func (any *numberLazyAny) ValueType() ValueType {
|
|
return NumberValue
|
|
}
|
|
|
|
func (any *numberLazyAny) MustBeValid() Any {
|
|
return any
|
|
}
|
|
|
|
func (any *numberLazyAny) LastError() error {
|
|
return any.err
|
|
}
|
|
|
|
func (any *numberLazyAny) ToBool() bool {
|
|
return any.ToFloat64() != 0
|
|
}
|
|
|
|
func (any *numberLazyAny) ToInt() int {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadInt()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToInt32() int32 {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadInt32()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToInt64() int64 {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadInt64()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToUint() uint {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadUint()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToUint32() uint32 {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadUint32()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToUint64() uint64 {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadUint64()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToFloat32() float32 {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadFloat32()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToFloat64() float64 {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
val := iter.ReadFloat64()
|
|
if iter.Error != nil && iter.Error != io.EOF {
|
|
any.err = iter.Error
|
|
}
|
|
return val
|
|
}
|
|
|
|
func (any *numberLazyAny) ToString() string {
|
|
return *(*string)(unsafe.Pointer(&any.buf))
|
|
}
|
|
|
|
func (any *numberLazyAny) WriteTo(stream *Stream) {
|
|
stream.Write(any.buf)
|
|
}
|
|
|
|
func (any *numberLazyAny) GetInterface() interface{} {
|
|
iter := any.cfg.BorrowIterator(any.buf)
|
|
defer any.cfg.ReturnIterator(iter)
|
|
return iter.Read()
|
|
}
|