Skip to content

Commit

Permalink
fix docstring and error message
Browse files Browse the repository at this point in the history
  • Loading branch information
petedannemann committed Nov 22, 2023
1 parent cc4eb74 commit f0c3f09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/admin/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ type ACLInfo struct {
PermissionType ACLPermissionType `json:"permissionType"`
}

// String is used both by fmt.Print and by Cobra in help text.
// FormatACLInfo formats an ACLInfo struct as a string, using the
// string version of all the fields.
func FormatACLInfo(a ACLInfo) string {
alias := struct {
ResourceType string
Expand Down
6 changes: 5 additions & 1 deletion pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ func (c *CLIRunner) DeleteACL(ctx context.Context, filter kafka.DeleteACLsFilter
}

if len(clusterACLs) > 1 {
return fmt.Errorf("Delete filter should only match a single ACL, got: \n%+v ", formatACLs(clusterACLs))
var formattedClusterACLs []string
for _, clusterACL := range clusterACLs {
formattedClusterACLs = append(formattedClusterACLs, admin.FormatACLInfo(clusterACL))
}
return fmt.Errorf("Delete filter should only match a single ACL. Use more specific filter flags to narrow down on a single ACL. ACLs matching filter: \n%+v", strings.Join(formattedClusterACLs, "\n"))
}

clusterACL := clusterACLs[0]
Expand Down

0 comments on commit f0c3f09

Please sign in to comment.