Skip to content

Commit 7eb75d5

Browse files
authored
Merge pull request #148 from oduwsdl/fix-deprecated-io
Update io reading functions with non-deprecated counterparts
2 parents 8fd5a11 + 9a7af50 commit 7eb75d5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"container/list"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"log"
99
"math/rand"
1010
flag "mflag"
@@ -169,7 +169,7 @@ var spoofAgents = []string{
169169

170170
func readArchives() (body []byte, err error) {
171171
if !regs["isprtcl"].MatchString(*arcsloc) {
172-
body, err = ioutil.ReadFile(*arcsloc)
172+
body, err = os.ReadFile(*arcsloc)
173173
return
174174
}
175175
res, err := http.Get(*arcsloc)
@@ -181,7 +181,7 @@ func readArchives() (body []byte, err error) {
181181
err = fmt.Errorf(res.Status)
182182
return
183183
}
184-
body, err = ioutil.ReadAll(res.Body)
184+
body, err = io.ReadAll(res.Body)
185185
return
186186
}
187187

@@ -312,7 +312,7 @@ func fetchTimemap(urir string, arch *Archive, tmCh chan *list.List, wg *sync.Wai
312312
}
313313
lnks := res.Header.Get("Link")
314314
if dttmp == nil {
315-
body, err := ioutil.ReadAll(res.Body)
315+
body, err := io.ReadAll(res.Body)
316316
if err != nil {
317317
benchmarker(arch.ID, "timemapfetch", fmt.Sprintf("Response read error in %s", arch.Name), start, sess)
318318
logError.Printf("%s => Response read error: %v", arch.ID, err)
@@ -858,8 +858,8 @@ func usage() {
858858
func initLoggers() {
859859
logFatal = log.New(os.Stderr, "FATAL: ", log.Lshortfile)
860860
errorHandle := os.Stderr
861-
infoHandle := ioutil.Discard
862-
benchmarkHandle := ioutil.Discard
861+
infoHandle := io.Discard
862+
benchmarkHandle := io.Discard
863863
if *logfile != "" {
864864
lgf, err := os.OpenFile(*logfile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
865865
if err != nil {

0 commit comments

Comments
 (0)