Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions pkg/internal/common/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package common

import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"reflect"
"time"
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/internal/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"math"
"os"
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pkg/internal/unit21/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pkg/service/geofencing.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package service

import (
"encoding/json"
"io/ioutil"
"io"
"net/http"
"os"

Expand Down Expand Up @@ -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)
Expand Down