feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
25
vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go
generated
vendored
25
vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go
generated
vendored
@@ -268,7 +268,11 @@ func guessType(scanner *sc.Scanner, raw string, allowSlice bool) *Argument {
|
||||
subScanner := parserScanner(subRaw, scanner.Error)
|
||||
|
||||
var tok rune
|
||||
for tok = subScanner.Scan(); tok != ',' && tok != sc.EOF && tok != ';'; tok = subScanner.Scan() {
|
||||
for {
|
||||
tok = subScanner.Scan()
|
||||
if tok == ',' || tok == sc.EOF || tok == ';' {
|
||||
break
|
||||
}
|
||||
// wait till we get something interesting
|
||||
}
|
||||
|
||||
@@ -306,6 +310,7 @@ func guessType(scanner *sc.Scanner, raw string, allowSlice bool) *Argument {
|
||||
// We'll cross that bridge when we get there.
|
||||
|
||||
// look ahead till we can figure out if this is a map or a slice
|
||||
hint = peekNoSpace(subScanner)
|
||||
firstElemType := guessType(subScanner, subRaw, false)
|
||||
if firstElemType.Type == StringType {
|
||||
// might be a map or slice, parse the string and check for colon
|
||||
@@ -313,8 +318,9 @@ func guessType(scanner *sc.Scanner, raw string, allowSlice bool) *Argument {
|
||||
var keyVal string // just ignore this
|
||||
(&Argument{Type: StringType}).parseString(subScanner, raw, reflect.Indirect(reflect.ValueOf(&keyVal)))
|
||||
|
||||
if subScanner.Scan() == ':' {
|
||||
if token := subScanner.Scan(); token == ':' || hint == '}' {
|
||||
// it's got a string followed by a colon -- it's a map
|
||||
// or an empty map in case of {}
|
||||
return &Argument{
|
||||
Type: MapType,
|
||||
ItemType: &Argument{Type: AnyType},
|
||||
@@ -369,6 +375,14 @@ func guessType(scanner *sc.Scanner, raw string, allowSlice bool) *Argument {
|
||||
|
||||
// parseString parses either of the two accepted string forms (quoted, or bare tokens).
|
||||
func (a *Argument) parseString(scanner *sc.Scanner, raw string, out reflect.Value) {
|
||||
// we need to temporarily disable the scanner's int/float parsing, since we want to
|
||||
// prevent number parsing errors.
|
||||
oldMode := scanner.Mode
|
||||
scanner.Mode = oldMode &^ sc.ScanInts &^ sc.ScanFloats
|
||||
defer func() {
|
||||
scanner.Mode = oldMode
|
||||
}()
|
||||
|
||||
// strings are a bit weird -- the "easy" case is quoted strings (tokenized as strings),
|
||||
// the "hard" case (present for backwards compat) is a bare sequence of tokens that aren't
|
||||
// a comma.
|
||||
@@ -495,7 +509,12 @@ func (a *Argument) parse(scanner *sc.Scanner, raw string, out reflect.Value, inS
|
||||
// raw consumes everything else
|
||||
castAndSet(out, reflect.ValueOf(raw[scanner.Pos().Offset:]))
|
||||
// consume everything else
|
||||
for tok := scanner.Scan(); tok != sc.EOF; tok = scanner.Scan() {
|
||||
var tok rune
|
||||
for {
|
||||
tok = scanner.Scan()
|
||||
if tok == sc.EOF {
|
||||
break
|
||||
}
|
||||
}
|
||||
case NumberType:
|
||||
nextChar := scanner.Peek()
|
||||
|
||||
Reference in New Issue
Block a user