Skip to content

Commit

Permalink
Fix complaints using printf from go vet
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Rutkowski <[email protected]>
  • Loading branch information
mrutkows committed Nov 7, 2024
1 parent 50685e8 commit 86e0414
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions cmd/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package cmd

import (
"encoding/csv"
"errors"
"fmt"
"io"
"sort"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions cmd/license_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package cmd

import (
"encoding/csv"
"errors"
"fmt"
"io"
"sort"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 86e0414

Please sign in to comment.