Skip to content

Commit

Permalink
Merge pull request #55948 from munnerz/patch-2
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 55841, 55948, 55945). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

conversion-gen: check for nil pkg in getManualConversionFunctions

**What this PR does / why we need it**:

Following kubernetes/kubernetes#54394, this PR performs a check in getManualConversionFunctions for packages that are not found and prints a warning instead of panicking.

This should improve the UX of conversion-gen, and is also a narrower change than that proposed in #54394, so hopefully can be cherry picked into the release-1.8 etc. branches.

This would allow users to use conversion-gen via the generate-internal-groups.sh script without having to make a second call that 'blanks out' `--extra-peer-dirs`.

/cc @sttts

```release-note
NONE
```

Kubernetes-commit: a83f78efc9f98b71b4604acf6ba14a4a51eceac8
  • Loading branch information
k8s-publish-robot committed Nov 28, 2017
2 parents ca893af + 792cc1b commit 310d4f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/conversion-gen/generators/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ type conversionFuncMap map[conversionPair]*types.Type

// Returns all manually-defined conversion functions in the package.
func getManualConversionFunctions(context *generator.Context, pkg *types.Package, manualMap conversionFuncMap) {
if pkg == nil {
glog.Warningf("Skipping nil package passed to getManualConversionFunctions")
return
}
glog.V(5).Infof("Scanning for conversion functions in %v", pkg.Name)

scopeName := types.Ref(conversionPackagePath, "Scope").Name
Expand Down

0 comments on commit 310d4f0

Please sign in to comment.