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
9
vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go
generated
vendored
9
vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go
generated
vendored
@@ -31,7 +31,7 @@ import (
|
||||
type Collector struct {
|
||||
*Registry
|
||||
|
||||
byPackage map[string]map[ast.Node]MarkerValues
|
||||
byPackage map[*loader.Package]map[ast.Node]MarkerValues
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ func (c *Collector) init() {
|
||||
c.Registry = &Registry{}
|
||||
}
|
||||
if c.byPackage == nil {
|
||||
c.byPackage = make(map[string]map[ast.Node]MarkerValues)
|
||||
c.byPackage = make(map[*loader.Package]map[ast.Node]MarkerValues)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func (c *Collector) init() {
|
||||
func (c *Collector) MarkersInPackage(pkg *loader.Package) (map[ast.Node]MarkerValues, error) {
|
||||
c.mu.Lock()
|
||||
c.init()
|
||||
if markers, exist := c.byPackage[pkg.ID]; exist {
|
||||
if markers, exist := c.byPackage[pkg]; exist {
|
||||
c.mu.Unlock()
|
||||
return markers, nil
|
||||
}
|
||||
@@ -91,8 +91,7 @@ func (c *Collector) MarkersInPackage(pkg *loader.Package) (map[ast.Node]MarkerVa
|
||||
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.byPackage[pkg.ID] = markers
|
||||
|
||||
c.byPackage[pkg] = markers
|
||||
return markers, nil
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
|
||||
20
vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go
generated
vendored
20
vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go
generated
vendored
@@ -58,6 +58,13 @@ func extractDoc(node ast.Node, decl *ast.GenDecl) string {
|
||||
}
|
||||
outGroup.List = append(outGroup.List, comment)
|
||||
}
|
||||
isAsteriskComment := false
|
||||
for _, l := range outGroup.List {
|
||||
if strings.HasPrefix(l.Text, "/*") {
|
||||
isAsteriskComment = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// split lines, and re-join together as a single
|
||||
// paragraph, respecting double-newlines as
|
||||
@@ -69,10 +76,12 @@ func extractDoc(node ast.Node, decl *ast.GenDecl) string {
|
||||
}
|
||||
|
||||
for i, line := range outLines {
|
||||
// Trim any extranous whitespace,
|
||||
// for handling /*…*/-style comments,
|
||||
// which have whitespace preserved in go/ast:
|
||||
line = strings.TrimSpace(line)
|
||||
if isAsteriskComment {
|
||||
// Trim any extranous whitespace,
|
||||
// for handling /*…*/-style comments,
|
||||
// which have whitespace preserved in go/ast:
|
||||
line = strings.TrimSpace(line)
|
||||
}
|
||||
|
||||
// Respect that double-newline means
|
||||
// actual newline:
|
||||
@@ -82,8 +91,7 @@ func extractDoc(node ast.Node, decl *ast.GenDecl) string {
|
||||
outLines[i] = line
|
||||
}
|
||||
}
|
||||
|
||||
return strings.Join(outLines, " ")
|
||||
return strings.Join(outLines, "\n")
|
||||
}
|
||||
|
||||
// PackageMarkers collects all the package-level marker values for the given package.
|
||||
|
||||
Reference in New Issue
Block a user