X-Git-Url: http://www.git.cypherpunks.ru/?p=gocheese.git;a=blobdiff_plain;f=refresh.go;h=ea3af19c049d4738273a63f9189267577914e5f7;hp=607ef4c50281bea7d5e9fd8bd114a92a1dd056fa;hb=6f8bc330934aacc401c00d9c3d0cf8eeceb296b1;hpb=10711e8819e19eae53fdd0f4252acfeb8619ef09 diff --git a/refresh.go b/refresh.go index 607ef4c..ea3af19 100644 --- a/refresh.go +++ b/refresh.go @@ -28,7 +28,6 @@ import ( "errors" "hash" "io" - "io/ioutil" "log" "net/http" "net/url" @@ -115,7 +114,7 @@ func refreshDir( http.Error(w, "PyPI has non 200 status code", http.StatusBadGateway) return false } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { resp.Body.Close() log.Println("error", r.RemoteAddr, "refresh-json", pkgName, err) @@ -240,7 +239,7 @@ func refreshDir( return false } path := filepath.Join(dirPath, MDFile) - existing, err := ioutil.ReadFile(path) + existing, err := os.ReadFile(path) if err != nil || bytes.Compare(existing, buf.Bytes()) != 0 { if err = WriteFileSync(dirPath, path, buf.Bytes(), now); err != nil { log.Println("error", r.RemoteAddr, "refresh-json", path, err) @@ -284,7 +283,7 @@ func refreshDir( http.Error(w, "PyPI has non 200 status code", http.StatusBadGateway) return false } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) resp.Body.Close() if err != nil { log.Println("error", r.RemoteAddr, "refresh", pkgName, err) @@ -434,7 +433,7 @@ func refreshDir( http.Error(w, "digest mismatch", http.StatusBadGateway) return false } - if digestStored, err := ioutil.ReadFile(path + "." + hashAlgo); err == nil && + if digestStored, err := os.ReadFile(path + "." + hashAlgo); err == nil && bytes.Compare(digest, digestStored) != 0 { err = errors.New("stored digest mismatch") log.Println("error", r.RemoteAddr, "pypi", filename, err) @@ -531,7 +530,7 @@ func refreshDir( resp.Body.Close() goto GPGSigSkip } - sig, err := ioutil.ReadAll(resp.Body) + sig, err := io.ReadAll(resp.Body) resp.Body.Close() if err != nil { goto GPGSigSkip