Skip to content

Commit e876b7d

Browse files
thockink8s-publishing-bot
authored andcommitted
No need to check nil iterating gengo Inputs
Kubernetes-commit: 242b4e27c05488d3f681c3dbf340e4a797c6f15d
1 parent f1b4eb5 commit e876b7d

File tree

4 files changed

+2
-20
lines changed

4 files changed

+2
-20
lines changed

cmd/conversion-gen/generators/conversion.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
225225
klog.V(3).Infof("pre-processing pkg %q", i)
226226

227227
pkg := context.Universe[i]
228-
if pkg == nil {
229-
// If the input had no Go files, for example.
230-
continue
231-
}
232228

233229
// Only generate conversions for packages which explicitly request it
234230
// by specifying one or more "+k8s:conversion-gen=<peer-pkg>"

cmd/deepcopy-gen/generators/deepcopy.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,8 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
138138

139139
for _, i := range context.Inputs {
140140
klog.V(3).Infof("Considering pkg %q", i)
141+
141142
pkg := context.Universe[i]
142-
if pkg == nil {
143-
// If the input had no Go files, for example.
144-
continue
145-
}
146143

147144
ptag := extractEnabledTag(pkg.Comments)
148145
ptagValue := ""

cmd/defaulter-gen/generators/defaulter.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
244244
klog.V(5).Infof("considering pkg %q", i)
245245

246246
pkg := context.Universe[i]
247-
if pkg == nil {
248-
// If the input had no Go files, for example.
249-
continue
250-
}
251247

252248
// if the types are not in the same package where the defaulter functions to be generated
253249
inputTags := extractInputTag(pkg.Comments)
@@ -299,10 +295,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
299295

300296
for _, i := range context.Inputs {
301297
pkg := context.Universe[i]
302-
if pkg == nil {
303-
// If the input had no Go files, for example.
304-
continue
305-
}
306298

307299
// typesPkg is where the types that needs defaulter are defined.
308300
// Sometimes it is different from pkg. For example, kubernetes core/v1

cmd/prerelease-lifecycle-gen/prerelease-lifecycle-generators/status.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,8 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target
187187

188188
for _, i := range context.Inputs {
189189
klog.V(5).Infof("Considering pkg %q", i)
190+
190191
pkg := context.Universe[i]
191-
if pkg == nil {
192-
// If the input had no Go files, for example.
193-
continue
194-
}
195192

196193
ptag := extractTag(tagEnabledName, pkg.Comments)
197194
pkgNeedsGeneration := false

0 commit comments

Comments
 (0)