Skip to content

Commit

Permalink
stop using deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kpacha committed Sep 19, 2024
1 parent 13cce99 commit e02dc60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions config_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lua

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

Expand Down Expand Up @@ -30,7 +29,7 @@ func TestParse(t *testing.T) {
t.Errorf("unexpected error: %v", err)
return
}
b, _ := ioutil.ReadFile(source)
b, _ := os.ReadFile(source)
if src, ok := cfg.Get(source); !ok || src != string(b) {
t.Errorf("wrong content %s", string(b))
}
Expand All @@ -46,7 +45,7 @@ func TestParse(t *testing.T) {
}

func TestParse_live(t *testing.T) {
tmpfile, err := ioutil.TempFile("", "test_parse_live")
tmpfile, err := os.CreateTemp("", "test_parse_live")
if err != nil {
t.Error(err)
return
Expand Down Expand Up @@ -85,7 +84,7 @@ func TestParse_live(t *testing.T) {
t.Errorf("wrong content %s", src)
}

if err := ioutil.WriteFile(source, []byte(finalContent), 0644); err != nil {
if err := os.WriteFile(source, []byte(finalContent), 0644); err != nil {
t.Error(err)
return
}
Expand Down
4 changes: 2 additions & 2 deletions router/gin/lua_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gin

import (
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestHandlerFactory(t *testing.T) {
if e := c.Query("extra"); e != "foo" {
t.Errorf("unexpected querystring extra: '%s'", e)
}
b, err := ioutil.ReadAll(c.Request.Body)
b, err := io.ReadAll(c.Request.Body)
if err != nil {
t.Error(err)
return
Expand Down
4 changes: 2 additions & 2 deletions router/mux/lua_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mux

import (
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"testing"
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestHandlerFactory(t *testing.T) {
// if id := c.Param("id"); id != "42" {
// t.Errorf("unexpected param id: %s", id)
// }
b, err := ioutil.ReadAll(r.Body)
b, err := io.ReadAll(r.Body)
if err != nil {
t.Error(err)
return
Expand Down

0 comments on commit e02dc60

Please sign in to comment.