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

fix bug in list services maturity cmd #259

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/cmd/maturity.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ There are multiple output formats that are useful
categoriesConn, err := client.ListCategories(nil)
cobra.CheckErr(err)
categories := categoriesConn.Nodes
data, err := client.ListServicesMaturity()
response, err := client.ListServicesMaturity(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

@davidbloss the nilaway PR I have is not ready yet, but this is an example of a situation where we're vulnerable to nil pointer exceptions.

The checkErr should be done before accessing response.Nodes since response could be nil.

Approving PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shuffled ✅

cobra.CheckErr(err)
data := response.Nodes
headers := []string{"Name", "Overall"}
sort.Slice(categories, func(i, j int) bool {
return categories[i].Name < categories[j].Name
Expand Down
Loading