mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
Replaced deprecated io/ioutil functions (#768)
Signed-off-by: slab713 <109306207+slab713@users.noreply.github.com>
This commit is contained in:
+3
-4
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
mrand "math/rand"
|
||||
"net/http"
|
||||
@@ -118,7 +117,7 @@ func pullAndCollect(url string, repos []string, manifestItem manifestStruct,
|
||||
manifestBody := resp.Body()
|
||||
|
||||
// file copy simulation
|
||||
_, err = io.Copy(ioutil.Discard, bytes.NewReader(manifestBody))
|
||||
_, err = io.Copy(io.Discard, bytes.NewReader(manifestBody))
|
||||
|
||||
latency = time.Since(start)
|
||||
|
||||
@@ -176,7 +175,7 @@ func pullAndCollect(url string, repos []string, manifestItem manifestStruct,
|
||||
configBody := resp.Body()
|
||||
|
||||
// file copy simulation
|
||||
_, err = io.Copy(ioutil.Discard, bytes.NewReader(configBody))
|
||||
_, err = io.Copy(io.Discard, bytes.NewReader(configBody))
|
||||
|
||||
latency = time.Since(start)
|
||||
|
||||
@@ -230,7 +229,7 @@ func pullAndCollect(url string, repos []string, manifestItem manifestStruct,
|
||||
blobBody := resp.Body()
|
||||
|
||||
// file copy simulation
|
||||
_, err = io.Copy(ioutil.Discard, bytes.NewReader(blobBody))
|
||||
_, err = io.Copy(io.Discard, bytes.NewReader(blobBody))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
+1
-2
@@ -4,7 +4,6 @@ import (
|
||||
crand "crypto/rand"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math/big"
|
||||
"net"
|
||||
@@ -724,7 +723,7 @@ func Perf(
|
||||
log.Fatal(err) // file closed on exit
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(fmt.Sprintf("%s.json", outFmt), jsonOut, defaultFilePerms); err != nil {
|
||||
if err := os.WriteFile(fmt.Sprintf("%s.json", outFmt), jsonOut, defaultFilePerms); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user