Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update io reading functions with non-deprecated counterparts #148

Merged
merged 2 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"container/list"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"math/rand"
flag "mflag"
Expand Down Expand Up @@ -169,7 +169,7 @@ var spoofAgents = []string{

func readArchives() (body []byte, err error) {
if !regs["isprtcl"].MatchString(*arcsloc) {
body, err = ioutil.ReadFile(*arcsloc)
body, err = os.ReadFile(*arcsloc)
return
}
res, err := http.Get(*arcsloc)
Expand All @@ -181,7 +181,7 @@ func readArchives() (body []byte, err error) {
err = fmt.Errorf(res.Status)
return
}
body, err = ioutil.ReadAll(res.Body)
body, err = io.ReadAll(res.Body)
return
}

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