diff --git a/charger/mcc_test.go b/charger/mcc_test.go index 39f5b45fd..822536678 100644 --- a/charger/mcc_test.go +++ b/charger/mcc_test.go @@ -2,7 +2,7 @@ package charger import ( "bytes" - "io/ioutil" + "io" "net/http" "reflect" "strings" @@ -59,7 +59,7 @@ func NewTestMobileConnect(t *testing.T, responses []apiResponse) *MobileConnect return &http.Response{ StatusCode: 200, // Send response to be tested - Body: ioutil.NopCloser(bytes.NewBufferString(responseString)), + Body: io.NopCloser(bytes.NewBufferString(responseString)), // Must be set to non-nil value or it panics Header: make(http.Header), } diff --git a/detect/http.go b/detect/http.go index ce08c7d8a..c2dcfe131 100644 --- a/detect/http.go +++ b/detect/http.go @@ -2,7 +2,7 @@ package detect import ( "fmt" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -94,7 +94,7 @@ func (h *HttpHandler) Test(log *util.Logger, ip string) []interface{} { } } - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil } diff --git a/util/log.go b/util/log.go index fd7a695a5..34f640c53 100644 --- a/util/log.go +++ b/util/log.go @@ -2,7 +2,6 @@ package util import ( "io" - "io/ioutil" "log" "os" "regexp" @@ -43,7 +42,7 @@ func NewLogger(area string) *Logger { } level := LogLevelForArea(area) - notepad := jww.NewNotepad(level, level, os.Stdout, ioutil.Discard, padded, log.Ldate|log.Ltime) + notepad := jww.NewNotepad(level, level, os.Stdout, io.Discard, padded, log.Ldate|log.Ltime) loggersMux.Lock() defer loggersMux.Unlock() diff --git a/util/request/functions.go b/util/request/functions.go index 2f88db3f8..39d900db9 100644 --- a/util/request/functions.go +++ b/util/request/functions.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" ) @@ -58,13 +57,13 @@ func (e StatusError) HasStatus(codes ...int) bool { func ReadBody(resp *http.Response) ([]byte, error) { defer resp.Body.Close() - b, err := ioutil.ReadAll(resp.Body) + b, err := io.ReadAll(resp.Body) if err != nil { return []byte{}, err } // maintain body after reading - resp.Body = ioutil.NopCloser(bytes.NewBuffer(b)) + resp.Body = io.NopCloser(bytes.NewBuffer(b)) if resp.StatusCode < 200 || resp.StatusCode >= 300 { return b, StatusError{resp: resp}