Skip to content

Commit

Permalink
fix: update ioutil to io and os package
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasbhat0 committed Aug 21, 2024
1 parent a637edc commit 5ab5456
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package common

import (
"fmt"
"io/ioutil"
"net/url"
"os"
"path"
"runtime"
"strconv"
Expand Down Expand Up @@ -78,7 +78,7 @@ func MustParseURL(uri string) *url.URL {
func GetCurrentVersion() int64 {
_, filename, _, _ := runtime.Caller(0)
dir := path.Join(path.Dir(filename), "./../")
dat, err := ioutil.ReadFile(path.Join(dir, "chain.version"))
dat, err := os.ReadFile(path.Join(dir, "chain.version"))
if err != nil {
panic(err)
}
Expand Down
3 changes: 1 addition & 2 deletions sentinel/claim_store_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sentinel

import (
"io/ioutil"
"os"
"testing"

Expand All @@ -18,7 +17,7 @@ type ClaimStoreSuite struct {

func (s *ClaimStoreSuite) SetUpTest() {
var err error
s.dir, err = ioutil.TempDir("/tmp", "claim-store")
s.dir, err = os.MkdirTemp("/tmp", "claim-store")
require.NoError(s.T(), err)
}

Expand Down
4 changes: 2 additions & 2 deletions sentinel/sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httputil"
"net/url"
Expand Down Expand Up @@ -222,7 +222,7 @@ func (p Proxy) handleContract(w http.ResponseWriter, r *http.Request) {
d, _ := json.Marshal(conf)
_, _ = w.Write(d)
case http.MethodPost:
body, err := ioutil.ReadAll(r.Body)
body, err := io.ReadAll(r.Body)
if err != nil {
http.Error(w, "Error reading request body", http.StatusInternalServerError)
return
Expand Down
3 changes: 1 addition & 2 deletions test/regression/cmd/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
Expand Down Expand Up @@ -397,7 +396,7 @@ func (op *OpCheck) Execute(_ *os.Process, logs chan string) error {
}

// read response
buf, err := ioutil.ReadAll(resp.Body)
buf, err := io.ReadAll(resp.Body)
if err != nil {
log.Err(err).Msg("failed to read response")
return err
Expand Down

0 comments on commit 5ab5456

Please sign in to comment.