update dependencies (#6267)
Signed-off-by: hongming <coder.scala@gmail.com>
This commit is contained in:
1
vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go
generated
vendored
1
vendor/sigs.k8s.io/controller-tools/pkg/markers/collect.go
generated
vendored
@@ -388,7 +388,6 @@ func (v markerSubVisitor) Visit(node ast.Node) ast.Visitor {
|
||||
v.commentInd = lastCommentInd + 1
|
||||
|
||||
return resVisitor
|
||||
|
||||
}
|
||||
|
||||
// associatedCommentsFor returns the doc comment group (if relevant and present) and end-of-line comment
|
||||
|
||||
12
vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go
generated
vendored
12
vendor/sigs.k8s.io/controller-tools/pkg/markers/parse.go
generated
vendored
@@ -820,13 +820,23 @@ func parserScanner(raw string, err func(*sc.Scanner, string)) *sc.Scanner {
|
||||
return scanner
|
||||
}
|
||||
|
||||
type markerParser interface {
|
||||
ParseMarker(name string, anonymousName string, restFields string) error
|
||||
}
|
||||
|
||||
// Parse uses the type information in this Definition to parse the given
|
||||
// raw marker in the form `+a:b:c=arg,d=arg` into an output object of the
|
||||
// type specified in the definition.
|
||||
func (d *Definition) Parse(rawMarker string) (interface{}, error) {
|
||||
name, anonName, fields := splitMarker(rawMarker)
|
||||
|
||||
out := reflect.Indirect(reflect.New(d.Output))
|
||||
outPointer := reflect.New(d.Output)
|
||||
out := reflect.Indirect(outPointer)
|
||||
|
||||
if parser, ok := outPointer.Interface().(markerParser); ok {
|
||||
err := parser.ParseMarker(name, anonName, fields)
|
||||
return out.Interface(), err
|
||||
}
|
||||
|
||||
// if we're a not a struct or have no arguments, treat the full `a:b:c` as the name,
|
||||
// otherwise, treat `c` as a field name, and `a:b` as the marker name.
|
||||
|
||||
37
vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go
generated
vendored
37
vendor/sigs.k8s.io/controller-tools/pkg/markers/zip.go
generated
vendored
@@ -69,13 +69,15 @@ func extractDoc(node ast.Node, decl *ast.GenDecl) string {
|
||||
// split lines, and re-join together as a single
|
||||
// paragraph, respecting double-newlines as
|
||||
// paragraph markers.
|
||||
outLines := strings.Split(outGroup.Text(), "\n")
|
||||
if outLines[len(outLines)-1] == "" {
|
||||
lines := strings.Split(outGroup.Text(), "\n")
|
||||
if lines[len(lines)-1] == "" {
|
||||
// chop off the extraneous last part
|
||||
outLines = outLines[:len(outLines)-1]
|
||||
lines = lines[:len(lines)-1]
|
||||
}
|
||||
|
||||
for i, line := range outLines {
|
||||
var outLines []string
|
||||
var insideCodeBlock bool
|
||||
for i, line := range lines {
|
||||
if isAsteriskComment {
|
||||
// Trim any extranous whitespace,
|
||||
// for handling /*…*/-style comments,
|
||||
@@ -86,10 +88,33 @@ func extractDoc(node ast.Node, decl *ast.GenDecl) string {
|
||||
// Respect that double-newline means
|
||||
// actual newline:
|
||||
if line == "" {
|
||||
outLines[i] = "\n"
|
||||
lines[i] = "\n"
|
||||
} else {
|
||||
outLines[i] = line
|
||||
lines[i] = line
|
||||
}
|
||||
|
||||
// Recognize markdown code blocks (``` or ~~~)
|
||||
// https://spec.commonmark.org/0.27/#fenced-code-blocks
|
||||
if strings.HasPrefix(line, "```") || strings.HasPrefix(line, "~~~") {
|
||||
insideCodeBlock = !insideCodeBlock
|
||||
}
|
||||
|
||||
if !insideCodeBlock {
|
||||
// If we are not inside markdown code block, follow the Kubernetes formatting conventions:
|
||||
// - Lines after --- are comments and should be ignored.
|
||||
// - Lines starting with TODO are comments and should be ignored.
|
||||
// See function fmtRawDoc() in https://github.com/kubernetes/apimachinery/blob/master/pkg/runtime/swagger_doc_generator.go
|
||||
|
||||
if strings.HasPrefix(line, "TODO") {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(line, "---") {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
outLines = append(outLines, line)
|
||||
}
|
||||
return strings.Join(outLines, "\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user