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
7 changes: 3 additions & 4 deletions auxlib_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 @@ -300,10 +299,10 @@ func TestOptChannel(t *testing.T) {
}

func TestLoadFileForShebang(t *testing.T) {
tmpFile, err := ioutil.TempFile("", "")
tmpFile, err := os.CreateTemp("", "")
errorIfNotNil(t, err)

err = ioutil.WriteFile(tmpFile.Name(), []byte(`#!/path/to/lua
err = os.WriteFile(tmpFile.Name(), []byte(`#!/path/to/lua
print("hello")
`), 0644)
errorIfNotNil(t, err)
Expand All @@ -321,7 +320,7 @@ print("hello")
}

func TestLoadFileForEmptyFile(t *testing.T) {
tmpFile, err := ioutil.TempFile("", "")
tmpFile, err := os.CreateTemp("", "")
errorIfNotNil(t, err)

defer func() {
Expand Down
5 changes: 2 additions & 3 deletions iolib.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"syscall"
Expand Down Expand Up @@ -373,7 +372,7 @@ func fileReadAux(L *LState, file *lFile, idx int) int {
L.Push(v)
case 'a':
var buf []byte
buf, err = ioutil.ReadAll(file.reader)
buf, err = io.ReadAll(file.reader)
if err == io.EOF {
L.Push(emptyLString)
goto normalreturn
Expand Down Expand Up @@ -704,7 +703,7 @@ func ioType(L *LState) int {
}

func ioTmpFile(L *LState) int {
file, err := ioutil.TempFile("", "")
file, err := os.CreateTemp("", "")
if err != nil {
L.Push(LNil)
L.Push(LString(err.Error()))
Expand Down
3 changes: 1 addition & 2 deletions oslib.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package lua

import (
"io/ioutil"
"os"
"strings"
"time"
Expand Down Expand Up @@ -223,7 +222,7 @@ func osTime(L *LState) int {
}

func osTmpname(L *LState) int {
file, err := ioutil.TempFile("", "")
file, err := os.CreateTemp("", "")
if err != nil {
L.RaiseError("unable to generate a unique filename")
}
Expand Down