Upgrade k8s.io/client-go to version 2
This commit is contained in:
parent
a3b95f798b
commit
6f4c5dd4ce
675 changed files with 109006 additions and 90744 deletions
16
vendor/gopkg.in/yaml.v2/decode.go
generated
vendored
16
vendor/gopkg.in/yaml.v2/decode.go
generated
vendored
|
@ -607,6 +607,15 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) {
|
|||
}
|
||||
name := settableValueOf("")
|
||||
l := len(n.children)
|
||||
|
||||
var inlineMap reflect.Value
|
||||
var elemType reflect.Type
|
||||
if sinfo.InlineMap != -1 {
|
||||
inlineMap = out.Field(sinfo.InlineMap)
|
||||
inlineMap.Set(reflect.New(inlineMap.Type()).Elem())
|
||||
elemType = inlineMap.Type().Elem()
|
||||
}
|
||||
|
||||
for i := 0; i < l; i += 2 {
|
||||
ni := n.children[i]
|
||||
if isMerge(ni) {
|
||||
|
@ -624,6 +633,13 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) {
|
|||
field = out.FieldByIndex(info.Inline)
|
||||
}
|
||||
d.unmarshal(n.children[i+1], field)
|
||||
} else if sinfo.InlineMap != -1 {
|
||||
if inlineMap.IsNil() {
|
||||
inlineMap.Set(reflect.MakeMap(inlineMap.Type()))
|
||||
}
|
||||
value := reflect.New(elemType).Elem()
|
||||
d.unmarshal(n.children[i+1], value)
|
||||
inlineMap.SetMapIndex(name, value)
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
|
2
vendor/gopkg.in/yaml.v2/emitterc.go
generated
vendored
2
vendor/gopkg.in/yaml.v2/emitterc.go
generated
vendored
|
@ -1019,7 +1019,7 @@ func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool {
|
|||
|
||||
preceeded_by_whitespace = true
|
||||
for i, w := 0, 0; i < len(value); i += w {
|
||||
w = width(value[0])
|
||||
w = width(value[i])
|
||||
followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w)
|
||||
|
||||
if i == 0 {
|
||||
|
|
17
vendor/gopkg.in/yaml.v2/encode.go
generated
vendored
17
vendor/gopkg.in/yaml.v2/encode.go
generated
vendored
|
@ -2,6 +2,7 @@ package yaml
|
|||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"sort"
|
||||
|
@ -164,6 +165,22 @@ func (e *encoder) structv(tag string, in reflect.Value) {
|
|||
e.flow = info.Flow
|
||||
e.marshal("", value)
|
||||
}
|
||||
if sinfo.InlineMap >= 0 {
|
||||
m := in.Field(sinfo.InlineMap)
|
||||
if m.Len() > 0 {
|
||||
e.flow = false
|
||||
keys := keyList(m.MapKeys())
|
||||
sort.Sort(keys)
|
||||
for _, k := range keys {
|
||||
if _, found := sinfo.FieldsMap[k.String()]; found {
|
||||
panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String()))
|
||||
}
|
||||
e.marshal("", k)
|
||||
e.flow = false
|
||||
e.marshal("", m.MapIndex(k))
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
34
vendor/gopkg.in/yaml.v2/scannerc.go
generated
vendored
34
vendor/gopkg.in/yaml.v2/scannerc.go
generated
vendored
|
@ -961,7 +961,7 @@ func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml
|
|||
}
|
||||
|
||||
// Pop indentation levels from the indents stack until the current level
|
||||
// becomes less or equal to the column. For each intendation level, append
|
||||
// becomes less or equal to the column. For each indentation level, append
|
||||
// the BLOCK-END token.
|
||||
func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool {
|
||||
// In the flow context, do nothing.
|
||||
|
@ -969,7 +969,7 @@ func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// Loop through the intendation levels in the stack.
|
||||
// Loop through the indentation levels in the stack.
|
||||
for parser.indent > column {
|
||||
// Create a token and append it to the queue.
|
||||
token := yaml_token_t{
|
||||
|
@ -2085,14 +2085,14 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l
|
|||
return false
|
||||
}
|
||||
if is_digit(parser.buffer, parser.buffer_pos) {
|
||||
// Check that the intendation is greater than 0.
|
||||
// Check that the indentation is greater than 0.
|
||||
if parser.buffer[parser.buffer_pos] == '0' {
|
||||
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
||||
start_mark, "found an intendation indicator equal to 0")
|
||||
start_mark, "found an indentation indicator equal to 0")
|
||||
return false
|
||||
}
|
||||
|
||||
// Get the intendation level and eat the indicator.
|
||||
// Get the indentation level and eat the indicator.
|
||||
increment = as_digit(parser.buffer, parser.buffer_pos)
|
||||
skip(parser)
|
||||
}
|
||||
|
@ -2102,7 +2102,7 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l
|
|||
|
||||
if parser.buffer[parser.buffer_pos] == '0' {
|
||||
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
||||
start_mark, "found an intendation indicator equal to 0")
|
||||
start_mark, "found an indentation indicator equal to 0")
|
||||
return false
|
||||
}
|
||||
increment = as_digit(parser.buffer, parser.buffer_pos)
|
||||
|
@ -2157,7 +2157,7 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l
|
|||
|
||||
end_mark := parser.mark
|
||||
|
||||
// Set the intendation level if it was specified.
|
||||
// Set the indentation level if it was specified.
|
||||
var indent int
|
||||
if increment > 0 {
|
||||
if parser.indent >= 0 {
|
||||
|
@ -2217,7 +2217,7 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l
|
|||
|
||||
leading_break = read_line(parser, leading_break)
|
||||
|
||||
// Eat the following intendation spaces and line breaks.
|
||||
// Eat the following indentation spaces and line breaks.
|
||||
if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) {
|
||||
return false
|
||||
}
|
||||
|
@ -2245,15 +2245,15 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l
|
|||
return true
|
||||
}
|
||||
|
||||
// Scan intendation spaces and line breaks for a block scalar. Determine the
|
||||
// intendation level if needed.
|
||||
// Scan indentation spaces and line breaks for a block scalar. Determine the
|
||||
// indentation level if needed.
|
||||
func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool {
|
||||
*end_mark = parser.mark
|
||||
|
||||
// Eat the intendation spaces and line breaks.
|
||||
// Eat the indentation spaces and line breaks.
|
||||
max_indent := 0
|
||||
for {
|
||||
// Eat the intendation spaces.
|
||||
// Eat the indentation spaces.
|
||||
if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
|
||||
return false
|
||||
}
|
||||
|
@ -2267,10 +2267,10 @@ func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, br
|
|||
max_indent = parser.mark.column
|
||||
}
|
||||
|
||||
// Check for a tab character messing the intendation.
|
||||
// Check for a tab character messing the indentation.
|
||||
if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) {
|
||||
return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
||||
start_mark, "found a tab character where an intendation space is expected")
|
||||
start_mark, "found a tab character where an indentation space is expected")
|
||||
}
|
||||
|
||||
// Have we found a non-empty line?
|
||||
|
@ -2655,10 +2655,10 @@ func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) b
|
|||
for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) {
|
||||
if is_blank(parser.buffer, parser.buffer_pos) {
|
||||
|
||||
// Check for tab character that abuse intendation.
|
||||
// Check for tab character that abuse indentation.
|
||||
if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) {
|
||||
yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
|
||||
start_mark, "found a tab character that violate intendation")
|
||||
start_mark, "found a tab character that violate indentation")
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -2687,7 +2687,7 @@ func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) b
|
|||
}
|
||||
}
|
||||
|
||||
// Check intendation level.
|
||||
// Check indentation level.
|
||||
if parser.flow_level == 0 && parser.mark.column < indent {
|
||||
break
|
||||
}
|
||||
|
|
30
vendor/gopkg.in/yaml.v2/yaml.go
generated
vendored
30
vendor/gopkg.in/yaml.v2/yaml.go
generated
vendored
|
@ -117,11 +117,12 @@ func Unmarshal(in []byte, out interface{}) (err error) {
|
|||
// Does not apply to zero valued structs.
|
||||
//
|
||||
// flow Marshal using a flow style (useful for structs,
|
||||
// sequences and maps.
|
||||
// sequences and maps).
|
||||
//
|
||||
// inline Inline the struct it's applied to, so its fields
|
||||
// are processed as if they were part of the outer
|
||||
// struct.
|
||||
// inline Inline the field, which must be a struct or a map,
|
||||
// causing all of its fields or keys to be processed as if
|
||||
// they were part of the outer struct. For maps, keys must
|
||||
// not conflict with the yaml keys of other struct fields.
|
||||
//
|
||||
// In addition, if the key is "-", the field is ignored.
|
||||
//
|
||||
|
@ -255,15 +256,14 @@ func getStructInfo(st reflect.Type) (*structInfo, error) {
|
|||
|
||||
if inline {
|
||||
switch field.Type.Kind() {
|
||||
// TODO: Implement support for inline maps.
|
||||
//case reflect.Map:
|
||||
// if inlineMap >= 0 {
|
||||
// return nil, errors.New("Multiple ,inline maps in struct " + st.String())
|
||||
// }
|
||||
// if field.Type.Key() != reflect.TypeOf("") {
|
||||
// return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String())
|
||||
// }
|
||||
// inlineMap = info.Num
|
||||
case reflect.Map:
|
||||
if inlineMap >= 0 {
|
||||
return nil, errors.New("Multiple ,inline maps in struct " + st.String())
|
||||
}
|
||||
if field.Type.Key() != reflect.TypeOf("") {
|
||||
return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String())
|
||||
}
|
||||
inlineMap = info.Num
|
||||
case reflect.Struct:
|
||||
sinfo, err := getStructInfo(field.Type)
|
||||
if err != nil {
|
||||
|
@ -324,13 +324,15 @@ func isZero(v reflect.Value) bool {
|
|||
return v.Len() == 0
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return v.Int() == 0
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return v.Float() == 0
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
return v.Uint() == 0
|
||||
case reflect.Bool:
|
||||
return !v.Bool()
|
||||
case reflect.Struct:
|
||||
vt := v.Type()
|
||||
for i := v.NumField()-1; i >= 0; i-- {
|
||||
for i := v.NumField() - 1; i >= 0; i-- {
|
||||
if vt.Field(i).PkgPath != "" {
|
||||
continue // Private field
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue