Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the type assertion on funk.Keys return value. #1256

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/kudoctl/cmd/package_list_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ func displayPlanTable(pf *packages.Files, withTasks bool, out io.Writer) {
}

func sortedPlanNames(pf *packages.Files) []string {
planNames := funk.Keys(pf.Operator.Plans).([]string)
planNames, ok := funk.Keys(pf.Operator.Plans).([]string)
if !ok {
panic("funk.Keys returned unexpected type")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't panic: for the most part we os.Exit(1) with some log message before. It gives us the chance to introduce different exit codes more smoothly later. Otherwise, LGTM

}
sort.Strings(planNames)
return planNames
}
Expand Down