all, checks.bash: restore unparam check
Restore the check for unused parameters and remove unused parameters
found by the check.
Change-Id: I80fe9b1cab507eeae8eb1f27e2395824330868c5
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/551436
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/checks.bash b/checks.bash
index 30afe24..622fa62 100755
--- a/checks.bash
+++ b/checks.bash
@@ -62,8 +62,7 @@
# check_unparam runs unparam on source files.
check_unparam() {
ensure_go_binary mvdan.cc/unparam
- # Temporarily exclude until updated for Go 1.20.
- # runcmd unparam ./...
+ runcmd unparam ./...
}
# check_vet runs go vet on source files.
diff --git a/cmd/cve/main.go b/cmd/cve/main.go
index f3c96ca..97b1b22 100644
--- a/cmd/cve/main.go
+++ b/cmd/cve/main.go
@@ -402,8 +402,7 @@
return false
}
- cveFile := fmt.Sprintf("data/cve/%s.json", goID)
- if err := addMissing(yamlReportFile, cveFile, deleted); err != nil {
+ if err := addMissing(yamlReportFile, deleted); err != nil {
fmt.Println("ERROR: could not add missing refs: ", err)
return false
}
@@ -412,7 +411,7 @@
return true
}
-func addMissing(yamlFile, cveFile string, missing []string) error {
+func addMissing(yamlFile string, missing []string) error {
r, err := report.Read(yamlFile)
if err != nil {
return err
diff --git a/cmd/forks/main.go b/cmd/forks/main.go
index 1f2e5f9..21aca43 100644
--- a/cmd/forks/main.go
+++ b/cmd/forks/main.go
@@ -55,7 +55,7 @@
Score int // 0 - 10
}
-func run(ctx context.Context) error {
+func run(_ context.Context) error {
if flag.NArg() == 0 {
flag.Usage()
return nil
diff --git a/internal/report/lint.go b/internal/report/lint.go
index 22fd444..40c62d6 100644
--- a/internal/report/lint.go
+++ b/internal/report/lint.go
@@ -312,7 +312,7 @@
// If there are no such paths listed in the report at all,
// another lint will complain, so reduce noise by not erroring here.
if paths := r.nonStdPaths(); len(paths) > 0 {
- if ok := containsPath(l, summary, paths); !ok {
+ if ok := containsPath(summary, paths); !ok {
l.Errorf("must contain an affected module or package path (e.g. %q)", paths[0])
}
}
@@ -324,7 +324,7 @@
// and is a prefix of a path, the function returns true. This gives us a
// workaround for reports that affect a lot of modules and/or have very long
// module paths.
-func containsPath(l *linter, summary string, paths []string) bool {
+func containsPath(summary string, paths []string) bool {
if len(paths) == 0 {
return false
}
diff --git a/internal/symbols/vuln_entries.go b/internal/symbols/vuln_entries.go
index f833bd6..773b525 100644
--- a/internal/symbols/vuln_entries.go
+++ b/internal/symbols/vuln_entries.go
@@ -44,7 +44,7 @@
// Identify vulnerable functions/methods in the call graph and
// compute the backwards reachable entries.
- entryNodes := vulnReachingEntries(cg, vulnFuncs(cg, m), entries)
+ entryNodes := vulnReachingEntries(vulnFuncs(cg, m), entries)
var vres []*ssa.Function
for _, n := range entryNodes {
vres = append(vres, n.Func)
@@ -80,9 +80,9 @@
return vfs
}
-// vulnReachingEntries returns call graph nodes of cg corresponding to allEntries
+// vulnReachingEntries returns call graph nodes corresponding to allEntries
// that are backwards reachable from sinks.
-func vulnReachingEntries(cg *callgraph.Graph, sinks []*callgraph.Node, allEntries []*ssa.Function) []*callgraph.Node {
+func vulnReachingEntries(sinks []*callgraph.Node, allEntries []*ssa.Function) []*callgraph.Node {
allEs := make(map[*ssa.Function]bool)
for _, e := range allEntries {
allEs[e] = true