Update dependencies for k8s v1.29.0
This commit is contained in:
23
client/vendor/k8s.io/gengo/generator/import_tracker.go
generated
vendored
23
client/vendor/k8s.io/gengo/generator/import_tracker.go
generated
vendored
@@ -26,15 +26,34 @@ import (
|
||||
"k8s.io/gengo/types"
|
||||
)
|
||||
|
||||
func NewImportTracker(typesToAdd ...*types.Type) *namer.DefaultImportTracker {
|
||||
tracker := namer.NewDefaultImportTracker(types.Name{})
|
||||
// NewImportTrackerForPackage creates a new import tracker which is aware
|
||||
// of a generator's output package. The tracker will not add import lines
|
||||
// when symbols or types are added from the same package, and LocalNameOf
|
||||
// will return empty string for the output package.
|
||||
//
|
||||
// e.g.:
|
||||
//
|
||||
// tracker := NewImportTrackerForPackage("bar.com/pkg/foo")
|
||||
// tracker.AddSymbol(types.Name{"bar.com/pkg/foo.MyType"})
|
||||
// tracker.AddSymbol(types.Name{"bar.com/pkg/baz.MyType"})
|
||||
// tracker.AddSymbol(types.Name{"bar.com/pkg/baz/baz.MyType"})
|
||||
//
|
||||
// tracker.LocalNameOf("bar.com/pkg/foo") -> ""
|
||||
// tracker.LocalNameOf("bar.com/pkg/baz") -> "baz"
|
||||
// tracker.LocalNameOf("bar.com/pkg/baz/baz") -> "bazbaz"
|
||||
// tracker.ImportLines() -> {`baz "bar.com/pkg/baz"`, `bazbaz "bar.com/pkg/baz/baz"`}
|
||||
func NewImportTrackerForPackage(local string, typesToAdd ...*types.Type) *namer.DefaultImportTracker {
|
||||
tracker := namer.NewDefaultImportTracker(types.Name{Package: local})
|
||||
tracker.IsInvalidType = func(*types.Type) bool { return false }
|
||||
tracker.LocalName = func(name types.Name) string { return golangTrackerLocalName(&tracker, name) }
|
||||
tracker.PrintImport = func(path, name string) string { return name + " \"" + path + "\"" }
|
||||
|
||||
tracker.AddTypes(typesToAdd...)
|
||||
return &tracker
|
||||
}
|
||||
|
||||
func NewImportTracker(typesToAdd ...*types.Type) *namer.DefaultImportTracker {
|
||||
return NewImportTrackerForPackage("", typesToAdd...)
|
||||
}
|
||||
|
||||
func golangTrackerLocalName(tracker namer.ImportTracker, t types.Name) string {
|
||||
|
Reference in New Issue
Block a user