sumdb: sync change from cmd/go internal package
Copy change in CL 203607 from cmd/go/internal/sumdb to
golang.org/x/mod/sumdb. This just removed an unused parameter. These
packages should be identical (except for imports) before
cmd/go/internal/sumdb is deleted in CL 202698.
Updates golang/go#31761
Change-Id: I1ce96d66bc71ef5c9515b68811049c47dce97765
Reviewed-on: https://go-review.googlesource.com/c/mod/+/204138
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/sumdb/server.go b/sumdb/server.go
index a4f8bee..28866f1 100644
--- a/sumdb/server.go
+++ b/sumdb/server.go
@@ -80,17 +80,17 @@
escPath, escVers := mod[:i], mod[i+1:]
path, err := module.UnescapePath(escPath)
if err != nil {
- reportError(w, r, err)
+ reportError(w, err)
return
}
vers, err := module.UnescapeVersion(escVers)
if err != nil {
- reportError(w, r, err)
+ reportError(w, err)
return
}
id, err := s.ops.Lookup(ctx, module.Version{Path: path, Version: vers})
if err != nil {
- reportError(w, r, err)
+ reportError(w, err)
return
}
records, err := s.ops.ReadRecords(ctx, id, 1)
@@ -137,7 +137,7 @@
start := t.N << uint(t.H)
records, err := s.ops.ReadRecords(ctx, start, int64(t.W))
if err != nil {
- reportError(w, r, err)
+ reportError(w, err)
return
}
if len(records) != t.W {
@@ -159,7 +159,7 @@
data, err := s.ops.ReadTileData(ctx, t)
if err != nil {
- reportError(w, r, err)
+ reportError(w, err)
return
}
w.Header().Set("Content-Type", "application/octet-stream")
@@ -172,7 +172,7 @@
// Otherwise it is an internal server error.
// The caller must only call reportError in contexts where
// a not-found err should be reported as 404.
-func reportError(w http.ResponseWriter, r *http.Request, err error) {
+func reportError(w http.ResponseWriter, err error) {
if os.IsNotExist(err) {
http.Error(w, err.Error(), http.StatusNotFound)
return