internal/frontend: address problems flagged by staticcheck
Change-Id: Ibc890184f8b9a0ec47525dbe07119f34a6001ea7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/444681
Reviewed-by: Jamal Carvalho <jamal@golang.org>
diff --git a/internal/frontend/overview.go b/internal/frontend/overview.go
index 13ceb61..7005631 100644
--- a/internal/frontend/overview.go
+++ b/internal/frontend/overview.go
@@ -72,7 +72,7 @@
//
// This function is exported for use in an external tool that uses this package to
// compare readme files to see how changes in processing will affect them.
-func LegacyReadmeHTML(ctx context.Context, mi *internal.ModuleInfo, readme *internal.Readme) (_ safehtml.HTML, err error) {
+func LegacyReadmeHTML(_ context.Context, mi *internal.ModuleInfo, readme *internal.Readme) (_ safehtml.HTML, err error) {
defer derrors.Wrap(&err, "LegacyReadmeHTML(%s@%s)", mi.ModulePath, mi.Version)
if readme == nil || readme.Contents == "" {
return safehtml.HTML{}, nil
diff --git a/internal/frontend/search_test.go b/internal/frontend/search_test.go
index 94c5943..0b5b2e4 100644
--- a/internal/frontend/search_test.go
+++ b/internal/frontend/search_test.go
@@ -596,8 +596,8 @@
mode: searchModeVuln,
query: "CVE-2000-1",
wantPage: &VulnListPage{Entries: []OSVEntry{
- OSVEntry{testEntries[0]},
- OSVEntry{testEntries[1]},
+ {testEntries[0]},
+ {testEntries[1]},
}},
},
} {
diff --git a/internal/frontend/server.go b/internal/frontend/server.go
index 5ba2ae9..939a8f6 100644
--- a/internal/frontend/server.go
+++ b/internal/frontend/server.go
@@ -148,7 +148,7 @@
// https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#startup
// and for /_ah/warmup at
// https://cloud.google.com/appengine/docs/standard/go/configuring-warmup-requests.
- handle("/_ah/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ handle("/_ah/", http.HandlerFunc(func(_ http.ResponseWriter, r *http.Request) {
log.Infof(r.Context(), "Request made to %q", r.URL.Path)
}))
handle("/static/", s.staticHandler())
@@ -219,7 +219,7 @@
handle("/_debug/pprof/symbol", ifDebug(hpprof.Symbol))
handle("/_debug/pprof/trace", ifDebug(hpprof.Trace))
- handle("/_debug/info", ifDebug(func(w http.ResponseWriter, r *http.Request) {
+ handle("/_debug/info", ifDebug(func(w http.ResponseWriter, _ *http.Request) {
row := func(a, b string) {
fmt.Fprintf(w, "<tr><td>%s</td> <td>%s</td></tr>\n", a, b)
}
diff --git a/internal/frontend/styleguide.go b/internal/frontend/styleguide.go
index 958b9bd..32c7f12 100644
--- a/internal/frontend/styleguide.go
+++ b/internal/frontend/styleguide.go
@@ -195,7 +195,7 @@
// the paths to markdown files.
func markdownFiles(fsys fs.FS) ([]string, error) {
var matches []string
- err := fs.WalkDir(fsys, "shared", func(filepath string, d fs.DirEntry, err error) error {
+ err := fs.WalkDir(fsys, "shared", func(filepath string, _ fs.DirEntry, err error) error {
if err != nil {
return err
}