You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Logs at lower verbosity to match other generators
Switches major/minor return types to int
Prefixes generated method names with APILifecycle to avoid collisions
Adds a k8s:prerelease-lifecycle-gen:replacement=group,version,kind tag for indicating a replacement API
func (g*genPreleaseLifecycle) GenerateType(c*generator.Context, t*types.Type, w io.Writer) error {
407
-
klog.Infof("Generating prerelease-lifecycle for type %v", t)
459
+
klog.V(3).Infof("Generating prerelease-lifecycle for type %v", t)
408
460
409
461
sw:=generator.NewSnippetWriter(w, c, "$", "$")
410
-
args, err:=argsFromType(t)
462
+
args, err:=g.argsFromType(c, t)
411
463
iferr!=nil {
412
464
returnerr
413
465
}
414
466
415
-
ifversionedMethodOrDie("Introduced", t) ==nil {
416
-
sw.Do("// Introduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.\n", args)
sw.Do("// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.\n", args)
417
469
sw.Do("// It is controlled by \""+introducedTagName+"\" tags in types.go.\n", args)
418
-
sw.Do("func (in *$.type|intrapackage$) Introduced() (int64, int64) {\n", args)
470
+
sw.Do("func (in *$.type|intrapackage$) APILifecycleIntroduced() (major, minor int) {\n", args)
sw.Do("// Deprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.\n", args)
sw.Do("// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.\n", args)
424
476
sw.Do("// It is controlled by \""+deprecatedTagName+"\" tags in types.go or \""+introducedTagName+"\" plus three minor.\n", args)
425
-
sw.Do("func (in *$.type|intrapackage$) Deprecated() (int64, int64) {\n", args)
477
+
sw.Do("func (in *$.type|intrapackage$) APILifecycleDeprecated() (major, minor int) {\n", args)
sw.Do("// Removed is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.\n", args)
sw.Do("// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.\n", args)
484
+
sw.Do("// It is controlled by \""+replacementTagName+"=<group>,<version>,<kind>\" tags in types.go.\n", args)
485
+
sw.Do("func (in *$.type|intrapackage$) APILifecycleReplacement() ($.GroupVersionKind|raw$) {\n", args)
sw.Do("// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.\n", args)
431
492
sw.Do("// It is controlled by \""+removedTagName+"\" tags in types.go or \""+deprecatedTagName+"\" plus three minor.\n", args)
432
-
sw.Do("func (in *$.type|intrapackage$) Removed() (int64, int64) {\n", args)
493
+
sw.Do("func (in *$.type|intrapackage$) APILifecycleRemoved() (major, minor int) {\n", args)
0 commit comments