Skip to content

Commit

Permalink
cmd/vulnreport: remove return value from xref
Browse files Browse the repository at this point in the history
Remove error return value from xref, which always returns nil.

(Caught by unparam and blocking deploy of vulndb)

Change-Id: I4c9423f0d333d7beb9422ee558ed83f3dd99aebf
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590115
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Tatiana Bradley <tatianabradley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
  • Loading branch information
tatianab authored and gopherbot committed Jun 3, 2024
1 parent f714a15 commit c3c93c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
5 changes: 1 addition & 4 deletions cmd/vulnreport/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ func (c *creator) reportFromMeta(ctx context.Context, meta *reportMeta) error {
default:
// Regular, full-length reports.
addTODOs(r)
xrefs, err := c.xref(r)
if err != nil {
log.Warnf("%s: could not get cross-references: %s", r.ID, err)
} else if len(xrefs) != 0 {
if xrefs := c.xref(r); len(xrefs) != 0 {
log.Infof("%s: found cross-references: %s", r.ID, xrefs)
}
}
Expand Down
11 changes: 3 additions & 8 deletions cmd/vulnreport/xref.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,8 @@ func (x *xref) close() error { return nil }
// for the same CVE, GHSA, or module.
func (x *xref) run(ctx context.Context, input any) (err error) {
r := input.(*yamlReport)

vlog.Out(r.filename)
xrefs, err := x.xref(r)
if err != nil {
return err
}
vlog.Out(xrefs)
vlog.Out(x.xref(r))
return nil
}

Expand All @@ -68,7 +63,7 @@ type xrefer struct {
rc *report.Client
}

func (x *xrefer) xref(r *yamlReport) (string, error) {
func (x *xrefer) xref(r *yamlReport) string {
out := &strings.Builder{}
matches := x.rc.XRef(r.Report)
delete(matches, r.filename)
Expand All @@ -83,7 +78,7 @@ func (x *xrefer) xref(r *yamlReport) (string, error) {
}
}
}
return out.String(), nil
return out.String()
}

func (x *xrefer) xrefCount(mp string) (excluded, regular, notGoCode int) {
Expand Down

0 comments on commit c3c93c0

Please sign in to comment.