diff --git a/pkg/internal/common/json.go b/pkg/internal/common/json.go index 18c4cf56..8abc28e1 100644 --- a/pkg/internal/common/json.go +++ b/pkg/internal/common/json.go @@ -2,7 +2,7 @@ package common import ( "encoding/json" - "io/ioutil" + "io" "net/http" "reflect" "time" @@ -18,7 +18,7 @@ func GetJson(url string, target interface{}) error { return StringError(err) } defer response.Body.Close() - jsonData, err := ioutil.ReadAll(response.Body) + jsonData, err := io.ReadAll(response.Body) if err != nil { return StringError(err) } @@ -41,7 +41,7 @@ func GetJsonGeneric(url string, target interface{}) error { return StringError(err) } defer response.Body.Close() - jsonData, err := ioutil.ReadAll(response.Body) + jsonData, err := io.ReadAll(response.Body) if err != nil { return StringError(err) } diff --git a/pkg/internal/common/util.go b/pkg/internal/common/util.go index 15041d88..1139d7e7 100644 --- a/pkg/internal/common/util.go +++ b/pkg/internal/common/util.go @@ -6,7 +6,7 @@ import ( "encoding/hex" "encoding/json" "fmt" - "io/ioutil" + "io" "log" "math" "os" @@ -107,7 +107,7 @@ func BetterStringify(jsonBody any) (betterString string, err error) { bodyReader := bytes.NewReader(bodyBytes) - betterBytes, err := ioutil.ReadAll(bodyReader) + betterBytes, err := io.ReadAll(bodyReader) betterString = string(betterBytes) if err != nil { return betterString, StringError(err) diff --git a/pkg/internal/unit21/base.go b/pkg/internal/unit21/base.go index 1f0e6c89..143467f1 100644 --- a/pkg/internal/unit21/base.go +++ b/pkg/internal/unit21/base.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" "os" @@ -45,7 +45,7 @@ func u21Put(url string, jsonBody any) (body []byte, err error) { defer res.Body.Close() - body, err = ioutil.ReadAll(res.Body) + body, err = io.ReadAll(res.Body) if err != nil { log.Printf("Error extracting body from %s update request: %s", url, err) return nil, common.StringError(err) @@ -92,7 +92,7 @@ func u21Post(url string, jsonBody any) (body []byte, err error) { defer res.Body.Close() - body, err = ioutil.ReadAll(res.Body) + body, err = io.ReadAll(res.Body) if err != nil { log.Printf("Error extracting body from %s update response: %s", url, err) return nil, common.StringError(err) diff --git a/pkg/service/geofencing.go b/pkg/service/geofencing.go index d5b8f7b0..d6a31f7a 100644 --- a/pkg/service/geofencing.go +++ b/pkg/service/geofencing.go @@ -2,7 +2,7 @@ package service import ( "encoding/json" - "io/ioutil" + "io" "net/http" "os" @@ -95,7 +95,7 @@ func getLocationFromAPI(ip string) (GeoLocation, error) { } // read the response body - body, err := ioutil.ReadAll(res.Body) + body, err := io.ReadAll(res.Body) if err != nil { return GeoLocation{}, common.StringError(err)