diff --git a/cmd/component.go b/cmd/component.go index 7716352..8e12d21 100644 --- a/cmd/component.go +++ b/cmd/component.go @@ -20,6 +20,7 @@ package cmd import ( "encoding/csv" + "errors" "fmt" "io" "sort" @@ -395,7 +396,7 @@ func DisplayComponentListCSV(bom *schema.BOM, writer io.Writer, flags utils.Comp // unable to emit an error message into output stream return getLogger().Errorf("error writing to output (%v): %s", currentRow, err) } - return fmt.Errorf(currentRow[0]) + return errors.New(MSG_OUTPUT_NO_RESOURCES_FOUND) } // Sort Components prior to outputting @@ -443,7 +444,7 @@ func DisplayComponentListMarkdown(bom *schema.BOM, writer io.Writer, flags utils // Emit no components found warning into output if len(entries) == 0 { fmt.Fprintf(writer, "%s\n", MSG_OUTPUT_NO_COMPONENTS_FOUND) - return fmt.Errorf(MSG_OUTPUT_NO_COMPONENTS_FOUND) + return errors.New(MSG_OUTPUT_NO_COMPONENTS_FOUND) } // Sort Components prior to outputting diff --git a/cmd/license_policy.go b/cmd/license_policy.go index 8519cfb..f099fc5 100644 --- a/cmd/license_policy.go +++ b/cmd/license_policy.go @@ -20,6 +20,7 @@ package cmd import ( "encoding/csv" + "errors" "fmt" "io" "sort" @@ -262,7 +263,7 @@ func DisplayLicensePoliciesTabbedText(writer io.Writer, filteredPolicyMap *slice // Emit no schemas found warning into output // TODO Use only for Warning messages, do not emit in output table if len(keyNames) == 0 { - return fmt.Errorf(MSG_OUTPUT_NO_POLICIES_FOUND) + return errors.New(MSG_OUTPUT_NO_POLICIES_FOUND) } // Sort entries by family name @@ -353,7 +354,7 @@ func DisplayLicensePoliciesCSV(writer io.Writer, filteredPolicyMap *slicemultima // TODO Use only for Warning messages, do not emit in output table if len(keyNames) == 0 { fmt.Fprintf(writer, "%s\n", MSG_OUTPUT_NO_POLICIES_FOUND) - return fmt.Errorf(MSG_OUTPUT_NO_POLICIES_FOUND) + return errors.New(MSG_OUTPUT_NO_POLICIES_FOUND) } // Sort entries by family name @@ -405,7 +406,7 @@ func DisplayLicensePoliciesMarkdown(writer io.Writer, filteredPolicyMap *slicemu // TODO Use only for Warning messages, do not emit in output table if len(keyNames) == 0 { fmt.Fprintf(writer, "%s\n", MSG_OUTPUT_NO_POLICIES_FOUND) - return fmt.Errorf(MSG_OUTPUT_NO_POLICIES_FOUND) + return errors.New(MSG_OUTPUT_NO_POLICIES_FOUND) } // Sort entries by family name