squakez commented on a change in pull request #3153:
URL: https://github.com/apache/camel-k/pull/3153#discussion_r838288844



##########
File path: pkg/cmd/delete.go
##########
@@ -139,14 +139,14 @@ func getIntegration(ctx context.Context, c client.Client, 
name string, namespace
        return &answer, nil
 }
 
-func deleteIntegration(ctx context.Context, c client.Client, integration 
*v1.Integration) error {
+func deleteIntegration(cmd *cobra.Command, ctx context.Context, c 
client.Client, integration *v1.Integration) error {

Review comment:
       Lint error, please fix this as suggested by the linter.

##########
File path: pkg/cmd/delete.go
##########
@@ -139,14 +139,14 @@ func getIntegration(ctx context.Context, c client.Client, 
name string, namespace
        return &answer, nil
 }
 
-func deleteIntegration(ctx context.Context, c client.Client, integration 
*v1.Integration) error {
+func deleteIntegration(cmd *cobra.Command, ctx context.Context, c 
client.Client, integration *v1.Integration) error {
        deleted, binding, err := deleteKameletBindingIfExists(ctx, c, 
integration)
        if err != nil {
                return err
        }
        if deleted {
                // Deleting KameletBinding will automatically clean up the 
integration
-               fmt.Println("KameletBinding " + binding + " deleted")
+               fmt.Fprintln(cmd.OutOrStdout(),"KameletBinding " + binding + " 
deleted")

Review comment:
       Missing space before the "KameletBinding" parameter.

##########
File path: pkg/cmd/rebuild.go
##########
@@ -69,7 +69,7 @@ func (o *rebuildCmdOptions) rebuild(_ *cobra.Command, args 
[]string) error {
                return err
        }
 
-       fmt.Printf("%d integrations have been rebuilt\n", len(integrations))
+       fmt.Fprintf(cmd.OutOrStdout(),"%d integrations have been rebuilt\n", 
len(integrations))

Review comment:
       Another missing space. Likely you want to run `gofmt` to fix all 
formatting errors.

##########
File path: pkg/cmd/uninstall.go
##########
@@ -209,71 +209,71 @@ func (o *uninstallCmdOptions) 
uninstallClusterWideResources(ctx context.Context,
        if !o.SkipClusterRoleBindings || o.UninstallAll {
                if err := o.uninstallClusterRoleBindings(ctx, c); err != nil {
                        if k8serrors.IsForbidden(err) {
-                               return createActionNotAuthorizedError()
+                               return createActionNotAuthorizedError(cmd)
                        }
                        return err
                }
-               fmt.Printf("Camel K Cluster Role Bindings removed from 
cluster\n")
+               fmt.Fprintf(cmd.OutOrStdout(), "Camel K Cluster Role Bindings 
removed from cluster\n")
        }
 
        if !o.SkipClusterRoles || o.UninstallAll {
                if err := o.uninstallClusterRoles(ctx, c); err != nil {
                        if k8serrors.IsForbidden(err) {
-                               return createActionNotAuthorizedError()
+                               return createActionNotAuthorizedError(cmd)
                        }
                        return err
                }
-               fmt.Printf("Camel K Cluster Roles removed from cluster\n")
+               fmt.Fprintf(cmd.OutOrStdout(), "Camel K Cluster Roles removed 
from cluster\n")
        }
 
        return nil
 }
 
-func (o *uninstallCmdOptions) uninstallNamespaceRoles(ctx context.Context, c 
client.Client) error {
+func (o *uninstallCmdOptions) uninstallNamespaceRoles(cmd *cobra.Command, ctx 
context.Context, c client.Client) error {

Review comment:
       Lint error, please fix accordingly.

##########
File path: pkg/cmd/util_dependencies.go
##########
@@ -230,37 +231,37 @@ func createCamelCatalog(ctx context.Context) 
(*camel.RuntimeCatalog, error) {
        return catalog, nil
 }
 
-func outputDependencies(dependencies []string, format string) error {
+func outputDependencies(dependencies []string, format string, cmd 
*cobra.Command) error {
        if format != "" {
-               err := printDependencies(format, dependencies)
+               err := printDependencies(format, dependencies, cmd)
                if err != nil {
                        return err
                }
        } else {
                // Print output in text form
-               fmt.Println("dependencies:")
+               fmt.Fprintln(cmd.OutOrStdout(), "dependencies:")
                for _, dep := range dependencies {
-                       fmt.Printf("%v\n", dep)
+                       fmt.Fprintf(cmd.OutOrStdout(), "%v\n", dep)
                }
        }
 
        return nil
 }
 
-func printDependencies(format string, dependencies []string) error {
+func printDependencies(format string, dependencies []string, cmd 
*cobra.Command) error {
        switch format {
        case "yaml":
                data, err := util.DependenciesToYAML(dependencies)
                if err != nil {
                        return err
                }
-               fmt.Print(string(data))
+               fmt.Fprint(cmd.OutOrStdout(), string(data))
        case "json":
                data, err := util.DependenciesToJSON(dependencies)
                if err != nil {
                        return err
                }
-               fmt.Print(string(data))
+               fmt.Fprint(cmd.OutOrStdout(),string(data))

Review comment:
       Lint error, please fix accordingly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to