aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/web/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/internal/web/api.go')
-rw-r--r--src/cmd/go/internal/web/api.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cmd/go/internal/web/api.go b/src/cmd/go/internal/web/api.go
index 570818843b..9053b16b62 100644
--- a/src/cmd/go/internal/web/api.go
+++ b/src/cmd/go/internal/web/api.go
@@ -13,9 +13,8 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
+ "io/fs"
"net/url"
- "os"
"strings"
"unicode"
"unicode/utf8"
@@ -56,7 +55,7 @@ func (e *HTTPError) Error() string {
}
if err := e.Err; err != nil {
- if pErr, ok := e.Err.(*os.PathError); ok && strings.HasSuffix(e.URL, pErr.Path) {
+ if pErr, ok := e.Err.(*fs.PathError); ok && strings.HasSuffix(e.URL, pErr.Path) {
// Remove the redundant copy of the path.
err = pErr.Err
}
@@ -67,7 +66,7 @@ func (e *HTTPError) Error() string {
}
func (e *HTTPError) Is(target error) bool {
- return target == os.ErrNotExist && (e.StatusCode == 404 || e.StatusCode == 410)
+ return target == fs.ErrNotExist && (e.StatusCode == 404 || e.StatusCode == 410)
}
func (e *HTTPError) Unwrap() error {
@@ -87,7 +86,7 @@ func GetBytes(u *url.URL) ([]byte, error) {
if err := resp.Err(); err != nil {
return nil, err
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("reading %s: %v", u.Redacted(), err)
}
@@ -130,7 +129,7 @@ func (r *Response) formatErrorDetail() string {
}
// Ensure that r.errorDetail has been populated.
- _, _ = io.Copy(ioutil.Discard, r.Body)
+ _, _ = io.Copy(io.Discard, r.Body)
s := r.errorDetail.buf.String()
if !utf8.ValidString(s) {