cmd/vulnreport: remove return value from xref

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>
This commit is contained in:
Tatiana Bradley 2024-06-03 17:37:56 -04:00 коммит произвёл Gopher Robot
Родитель f714a15249
Коммит c3c93c09d3
2 изменённых файлов: 4 добавлений и 12 удалений

Просмотреть файл

@ -195,10 +195,7 @@ func (c *creator) reportFromMeta(ctx context.Context, meta *reportMeta) error {
default: default:
// Regular, full-length reports. // Regular, full-length reports.
addTODOs(r) addTODOs(r)
xrefs, err := c.xref(r) if xrefs := c.xref(r); len(xrefs) != 0 {
if err != nil {
log.Warnf("%s: could not get cross-references: %s", r.ID, err)
} else if len(xrefs) != 0 {
log.Infof("%s: found cross-references: %s", r.ID, xrefs) log.Infof("%s: found cross-references: %s", r.ID, xrefs)
} }
} }

Просмотреть файл

@ -41,13 +41,8 @@ func (x *xref) close() error { return nil }
// for the same CVE, GHSA, or module. // for the same CVE, GHSA, or module.
func (x *xref) run(ctx context.Context, input any) (err error) { func (x *xref) run(ctx context.Context, input any) (err error) {
r := input.(*yamlReport) r := input.(*yamlReport)
vlog.Out(r.filename) vlog.Out(r.filename)
xrefs, err := x.xref(r) vlog.Out(x.xref(r))
if err != nil {
return err
}
vlog.Out(xrefs)
return nil return nil
} }
@ -68,7 +63,7 @@ type xrefer struct {
rc *report.Client rc *report.Client
} }
func (x *xrefer) xref(r *yamlReport) (string, error) { func (x *xrefer) xref(r *yamlReport) string {
out := &strings.Builder{} out := &strings.Builder{}
matches := x.rc.XRef(r.Report) matches := x.rc.XRef(r.Report)
delete(matches, r.filename) delete(matches, r.filename)
@ -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) { func (x *xrefer) xrefCount(mp string) (excluded, regular, notGoCode int) {