No need to check nil iterating gengo Inputs

This commit is contained in:
Tim Hockin 2024-01-16 22:06:35 -08:00
parent 7a084b3352
commit 242b4e27c0
No known key found for this signature in database
4 changed files with 2 additions and 20 deletions

View File

@ -225,10 +225,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
klog.V(3).Infof("pre-processing pkg %q", i)
pkg := context.Universe[i]
if pkg == nil {
// If the input had no Go files, for example.
continue
}
// Only generate conversions for packages which explicitly request it
// by specifying one or more "+k8s:conversion-gen=<peer-pkg>"

View File

@ -138,11 +138,8 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
for _, i := range context.Inputs {
klog.V(3).Infof("Considering pkg %q", i)
pkg := context.Universe[i]
if pkg == nil {
// If the input had no Go files, for example.
continue
}
ptag := extractEnabledTag(pkg.Comments)
ptagValue := ""

View File

@ -244,10 +244,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
klog.V(5).Infof("considering pkg %q", i)
pkg := context.Universe[i]
if pkg == nil {
// If the input had no Go files, for example.
continue
}
// if the types are not in the same package where the defaulter functions to be generated
inputTags := extractInputTag(pkg.Comments)
@ -299,10 +295,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
for _, i := range context.Inputs {
pkg := context.Universe[i]
if pkg == nil {
// If the input had no Go files, for example.
continue
}
// typesPkg is where the types that needs defaulter are defined.
// Sometimes it is different from pkg. For example, kubernetes core/v1

View File

@ -187,11 +187,8 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
for _, i := range context.Inputs {
klog.V(5).Infof("Considering pkg %q", i)
pkg := context.Universe[i]
if pkg == nil {
// If the input had no Go files, for example.
continue
}
ptag := extractTag(tagEnabledName, pkg.Comments)
pkgNeedsGeneration := false