From 8f387d6e7bf404b39e42e7405718a30fceca24b6 Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Wed, 25 Oct 2017 12:15:31 -0500 Subject: [PATCH] Updates vendor directory to get code generation working correctly --- vendor/github.com/davecgh/go-spew/LICENSE | 2 +- .../github.com/davecgh/go-spew/spew/bypass.go | 6 +-- .../davecgh/go-spew/spew/bypasssafe.go | 38 +++++++++++++++++++ .../github.com/davecgh/go-spew/spew/common.go | 2 +- .../github.com/davecgh/go-spew/spew/dump.go | 10 ++--- .../github.com/davecgh/go-spew/spew/format.go | 4 +- vendor/github.com/ugorji/go/codec/binc.go | 9 ----- vendor/github.com/ugorji/go/codec/cbor.go | 9 ----- vendor/github.com/ugorji/go/codec/decode.go | 29 +++++--------- .../ugorji/go/codec/helper_not_unsafe.go | 16 -------- .../ugorji/go/codec/helper_unsafe.go | 16 +++----- vendor/github.com/ugorji/go/codec/msgpack.go | 9 ----- vendor/github.com/ugorji/go/codec/prebuild.sh | 26 +++++-------- vendor/github.com/ugorji/go/codec/simple.go | 9 ----- vendor/vendor.json | 12 +++--- 15 files changed, 82 insertions(+), 115 deletions(-) create mode 100644 vendor/github.com/davecgh/go-spew/spew/bypasssafe.go diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE index c836416192d..bc52e96f2b0 100644 --- a/vendor/github.com/davecgh/go-spew/LICENSE +++ b/vendor/github.com/davecgh/go-spew/LICENSE @@ -2,7 +2,7 @@ ISC License Copyright (c) 2012-2016 Dave Collins -Permission to use, copy, modify, and distribute this software for any +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go index 8a4a6589a2d..7f166c3a3d9 100644 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -41,9 +41,9 @@ var ( // after commit 82f48826c6c7 which changed the format again to mirror // the original format. Code in the init function updates these offsets // as necessary. - offsetPtr = uintptr(ptrSize) + offsetPtr = ptrSize offsetScalar = uintptr(0) - offsetFlag = uintptr(ptrSize * 2) + offsetFlag = ptrSize * 2 // flagKindWidth and flagKindShift indicate various bits that the // reflect package uses internally to track kind information. @@ -58,7 +58,7 @@ var ( // changed their positions. Code in the init function updates these // flags as necessary. flagKindWidth = uintptr(5) - flagKindShift = uintptr(flagKindWidth - 1) + flagKindShift = flagKindWidth - 1 flagRO = uintptr(1 << 0) flagIndir = uintptr(1 << 1) ) diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go new file mode 100644 index 00000000000..1fe3cf3d5d1 --- /dev/null +++ b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -0,0 +1,38 @@ +// Copyright (c) 2015-2016 Dave Collins +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// NOTE: Due to the following build constraints, this file will only be compiled +// when the code is running on Google App Engine, compiled by GopherJS, or +// "-tags safe" is added to the go build command line. The "disableunsafe" +// tag is deprecated and thus should not be used. +// +build js appengine safe disableunsafe + +package spew + +import "reflect" + +const ( + // UnsafeDisabled is a build-time constant which specifies whether or + // not access to the unsafe package is available. + UnsafeDisabled = true +) + +// unsafeReflectValue typically converts the passed reflect.Value into a one +// that bypasses the typical safety restrictions preventing access to +// unaddressable and unexported data. However, doing this relies on access to +// the unsafe package. This is a stub version which simply returns the passed +// reflect.Value when the unsafe package is not available. +func unsafeReflectValue(v reflect.Value) reflect.Value { + return v +} diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go index 7c519ff47ac..1be8ce94576 100644 --- a/vendor/github.com/davecgh/go-spew/spew/common.go +++ b/vendor/github.com/davecgh/go-spew/spew/common.go @@ -180,7 +180,7 @@ func printComplex(w io.Writer, c complex128, floatPrecision int) { w.Write(closeParenBytes) } -// printHexPtr outputs a uintptr formatted as hexidecimal with a leading '0x' +// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x' // prefix to Writer w. func printHexPtr(w io.Writer, p uintptr) { // Null pointer. diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go index df1d582a728..f78d89fc1f6 100644 --- a/vendor/github.com/davecgh/go-spew/spew/dump.go +++ b/vendor/github.com/davecgh/go-spew/spew/dump.go @@ -35,16 +35,16 @@ var ( // cCharRE is a regular expression that matches a cgo char. // It is used to detect character arrays to hexdump them. - cCharRE = regexp.MustCompile("^.*\\._Ctype_char$") + cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`) // cUnsignedCharRE is a regular expression that matches a cgo unsigned // char. It is used to detect unsigned character arrays to hexdump // them. - cUnsignedCharRE = regexp.MustCompile("^.*\\._Ctype_unsignedchar$") + cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`) // cUint8tCharRE is a regular expression that matches a cgo uint8_t. // It is used to detect uint8_t arrays to hexdump them. - cUint8tCharRE = regexp.MustCompile("^.*\\._Ctype_uint8_t$") + cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`) ) // dumpState contains information about the state of a dump operation. @@ -143,10 +143,10 @@ func (d *dumpState) dumpPtr(v reflect.Value) { // Display dereferenced value. d.w.Write(openParenBytes) switch { - case nilFound == true: + case nilFound: d.w.Write(nilAngleBytes) - case cycleFound == true: + case cycleFound: d.w.Write(circularBytes) default: diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go index c49875bacbb..b04edb7d7ac 100644 --- a/vendor/github.com/davecgh/go-spew/spew/format.go +++ b/vendor/github.com/davecgh/go-spew/spew/format.go @@ -182,10 +182,10 @@ func (f *formatState) formatPtr(v reflect.Value) { // Display dereferenced value. switch { - case nilFound == true: + case nilFound: f.fs.Write(nilAngleBytes) - case cycleFound == true: + case cycleFound: f.fs.Write(circularShortBytes) default: diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go index 618c51505f6..bdb2d5f19d8 100644 --- a/vendor/github.com/ugorji/go/codec/binc.go +++ b/vendor/github.com/ugorji/go/codec/binc.go @@ -356,9 +356,6 @@ func (d *bincDecDriver) uncacheRead() { } func (d *bincDecDriver) ContainerType() (vt valueType) { - if !d.bdRead { - d.readNextBd() - } if d.vd == bincVdSpecial && d.vs == bincSpNil { return valueTypeNil } else if d.vd == bincVdByteArray { @@ -583,9 +580,6 @@ func (d *bincDecDriver) DecodeBool() (b bool) { } func (d *bincDecDriver) ReadMapStart() (length int) { - if !d.bdRead { - d.readNextBd() - } if d.vd != bincVdMap { d.d.errorf("Invalid d.vd for map. Expecting 0x%x. Got: 0x%x", bincVdMap, d.vd) return @@ -596,9 +590,6 @@ func (d *bincDecDriver) ReadMapStart() (length int) { } func (d *bincDecDriver) ReadArrayStart() (length int) { - if !d.bdRead { - d.readNextBd() - } if d.vd != bincVdArray { d.d.errorf("Invalid d.vd for array. Expecting 0x%x. Got: 0x%x", bincVdArray, d.vd) return diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go index 4c72caffb21..ce3e0e043fe 100644 --- a/vendor/github.com/ugorji/go/codec/cbor.go +++ b/vendor/github.com/ugorji/go/codec/cbor.go @@ -196,9 +196,6 @@ func (d *cborDecDriver) uncacheRead() { } func (d *cborDecDriver) ContainerType() (vt valueType) { - if !d.bdRead { - d.readNextBd() - } if d.bd == cborBdNil { return valueTypeNil } else if d.bd == cborBdIndefiniteBytes || (d.bd >= cborBaseBytes && d.bd < cborBaseString) { @@ -354,9 +351,6 @@ func (d *cborDecDriver) DecodeBool() (b bool) { } func (d *cborDecDriver) ReadMapStart() (length int) { - if !d.bdRead { - d.readNextBd() - } d.bdRead = false if d.bd == cborBdIndefiniteMap { return -1 @@ -365,9 +359,6 @@ func (d *cborDecDriver) ReadMapStart() (length int) { } func (d *cborDecDriver) ReadArrayStart() (length int) { - if !d.bdRead { - d.readNextBd() - } d.bdRead = false if d.bd == cborBdIndefiniteArray { return -1 diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go index 2563668ba75..cbe2df48a3f 100644 --- a/vendor/github.com/ugorji/go/codec/decode.go +++ b/vendor/github.com/ugorji/go/codec/decode.go @@ -161,9 +161,7 @@ type DecodeOptions struct { // look them up from a map (than to allocate them afresh). // // Note: Handles will be smart when using the intern functionality. - // Every string should not be interned. - // An excellent use-case for interning is struct field names, - // or map keys where key type is string. + // So everything will not be interned. InternString bool // PreferArrayOverSlice controls whether to decode to an array or a slice. @@ -742,8 +740,7 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { if cr != nil { cr.sendContainerState(containerMapKey) } - rvkencnameB := dd.DecodeBytes(f.d.b[:], true, true) - rvkencname := stringView(rvkencnameB) + rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true)) // rvksi := ti.getForEncName(rvkencname) if cr != nil { cr.sendContainerState(containerMapValue) @@ -758,7 +755,6 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { } else { d.structFieldNotFound(-1, rvkencname) } - keepAlive4StringView(rvkencnameB) // maintain ref 4 stringView } } else { for j := 0; !dd.CheckBreak(); j++ { @@ -766,8 +762,7 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { if cr != nil { cr.sendContainerState(containerMapKey) } - rvkencnameB := dd.DecodeBytes(f.d.b[:], true, true) - rvkencname := stringView(rvkencnameB) + rvkencname := stringView(dd.DecodeBytes(f.d.b[:], true, true)) // rvksi := ti.getForEncName(rvkencname) if cr != nil { cr.sendContainerState(containerMapValue) @@ -782,7 +777,6 @@ func (f *decFnInfo) kStruct(rv reflect.Value) { } else { d.structFieldNotFound(-1, rvkencname) } - keepAlive4StringView(rvkencnameB) // maintain ref 4 stringView } } if cr != nil { @@ -1879,14 +1873,11 @@ func (d *Decoder) errorf(format string, params ...interface{}) { panic(err) } -// Possibly get an interned version of a string -// -// This should mostly be used for map keys, where the key type is string func (d *Decoder) string(v []byte) (s string) { if d.is != nil { - s, ok := d.is[string(v)] // no allocation here, per go implementation + s, ok := d.is[string(v)] // no allocation here. if !ok { - s = string(v) // new allocation here + s = string(v) d.is[s] = s } return s @@ -1894,11 +1885,11 @@ func (d *Decoder) string(v []byte) (s string) { return string(v) // don't return stringView, as we need a real string here. } -// func (d *Decoder) intern(s string) { -// if d.is != nil { -// d.is[s] = s -// } -// } +func (d *Decoder) intern(s string) { + if d.is != nil { + d.is[s] = s + } +} // nextValueBytes returns the next value in the stream as a set of bytes. func (d *Decoder) nextValueBytes() []byte { diff --git a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go index f254b988605..8b06a004590 100644 --- a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go @@ -8,9 +8,6 @@ package codec // stringView returns a view of the []byte as a string. // In unsafe mode, it doesn't incur allocation and copying caused by conversion. // In regular safe mode, it is an allocation and copy. -// -// Usage: Always maintain a reference to v while result of this call is in use, -// and call keepAlive4BytesView(v) at point where done with view. func stringView(v []byte) string { return string(v) } @@ -18,19 +15,6 @@ func stringView(v []byte) string { // bytesView returns a view of the string as a []byte. // In unsafe mode, it doesn't incur allocation and copying caused by conversion. // In regular safe mode, it is an allocation and copy. -// -// Usage: Always maintain a reference to v while result of this call is in use, -// and call keepAlive4BytesView(v) at point where done with view. func bytesView(v string) []byte { return []byte(v) } - -// keepAlive4BytesView maintains a reference to the input parameter for bytesView. -// -// Usage: call this at point where done with the bytes view. -func keepAlive4BytesView(v string) {} - -// keepAlive4BytesView maintains a reference to the input parameter for stringView. -// -// Usage: call this at point where done with the string view. -func keepAlive4StringView(v []byte) {} diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go index 6c146f77cd0..0f596c71aad 100644 --- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_unsafe.go @@ -6,12 +6,10 @@ package codec import ( - "runtime" "unsafe" ) // This file has unsafe variants of some helper methods. -// NOTE: See helper_not_unsafe.go for the usage information. type unsafeString struct { Data uintptr @@ -24,6 +22,9 @@ type unsafeSlice struct { Cap int } +// stringView returns a view of the []byte as a string. +// In unsafe mode, it doesn't incur allocation and copying caused by conversion. +// In regular safe mode, it is an allocation and copy. func stringView(v []byte) string { if len(v) == 0 { return "" @@ -34,6 +35,9 @@ func stringView(v []byte) string { return *(*string)(unsafe.Pointer(&sx)) } +// bytesView returns a view of the string as a []byte. +// In unsafe mode, it doesn't incur allocation and copying caused by conversion. +// In regular safe mode, it is an allocation and copy. func bytesView(v string) []byte { if len(v) == 0 { return zeroByteSlice @@ -43,11 +47,3 @@ func bytesView(v string) []byte { bx := unsafeSlice{sx.Data, sx.Len, sx.Len} return *(*[]byte)(unsafe.Pointer(&bx)) } - -func keepAlive4BytesView(v string) { - runtime.KeepAlive(v) -} - -func keepAlive4StringView(v []byte) { - runtime.KeepAlive(v) -} diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go index 73097697396..4907c6497db 100644 --- a/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/vendor/github.com/ugorji/go/codec/msgpack.go @@ -569,9 +569,6 @@ func (d *msgpackDecDriver) uncacheRead() { } func (d *msgpackDecDriver) ContainerType() (vt valueType) { - if !d.bdRead { - d.readNextBd() - } bd := d.bd if bd == mpNil { return valueTypeNil @@ -624,16 +621,10 @@ func (d *msgpackDecDriver) readContainerLen(ct msgpackContainerType) (clen int) } func (d *msgpackDecDriver) ReadMapStart() int { - if !d.bdRead { - d.readNextBd() - } return d.readContainerLen(msgpackContainerMap) } func (d *msgpackDecDriver) ReadArrayStart() int { - if !d.bdRead { - d.readNextBd() - } return d.readContainerLen(msgpackContainerList) } diff --git a/vendor/github.com/ugorji/go/codec/prebuild.sh b/vendor/github.com/ugorji/go/codec/prebuild.sh index 422c1a73424..909f4bb0f24 100755 --- a/vendor/github.com/ugorji/go/codec/prebuild.sh +++ b/vendor/github.com/ugorji/go/codec/prebuild.sh @@ -38,7 +38,7 @@ _build() { return 0 fi - # echo "Running prebuild" + # echo "Running prebuild" if [ "${zbak}" == "1" ] then # echo "Backing up old generated files" @@ -46,13 +46,12 @@ _build() { _gg=".generated.go" [ -e "gen-helper${_gg}" ] && mv gen-helper${_gg} gen-helper${_gg}__${_zts}.bak [ -e "fast-path${_gg}" ] && mv fast-path${_gg} fast-path${_gg}__${_zts}.bak - [ -e "gen${_gg}" ] && mv gen${_gg} gen${_gg}__${_zts}.bak # [ -e "safe${_gg}" ] && mv safe${_gg} safe${_gg}__${_zts}.bak # [ -e "unsafe${_gg}" ] && mv unsafe${_gg} unsafe${_gg}__${_zts}.bak - fi - rm -f gen-helper.generated.go fast-path.generated.go \ - gen.generated.go \ - *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go + else + rm -f fast-path.generated.go gen.generated.go gen-helper.generated.go \ + *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go + fi cat > gen.generated.go <