fix: Replaced ioutil as it was deprecated in Golang.

This commit is contained in:
James Wells 2024-02-09 12:47:17 -08:00
parent 82a964fc50
commit 97c8af8816
Signed by: jwells
GPG key ID: 73196D10B8E65666
18 changed files with 105 additions and 114 deletions

View file

@ -1,10 +1,10 @@
package picol
import (
"errors"
"fmt"
"strconv"
"strings"
errors "errors"
fmt "fmt"
strconv "strconv"
strings "strings"
)
/*

View file

@ -1,9 +1,9 @@
package picol_test
import (
"testing"
testing "testing"
"github.com/dragonheim/gagent/pkg/picol"
picol "github.com/dragonheim/gagent/pkg/picol"
)
func Test_NeedleInHaystack(t *testing.T) {

View file

@ -1,11 +1,11 @@
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"os"
bufio "bufio"
flag "flag"
fmt "fmt"
io "io"
os "os"
picol "github.com/dragonheim/gagent/pkg/picol"
)
@ -16,7 +16,7 @@ func RunPicol(fname string) error {
interp := picol.NewInterpreter()
interp.RegisterCoreCommands()
buf, err := ioutil.ReadFile(fname)
buf, err := io.ReadFile(fname)
if err == nil {
result, err := interp.Eval(string(buf))
if err != nil {

View file

@ -1,9 +1,9 @@
package main_test
import (
"io/ioutil"
"os"
"testing"
io "io"
os "os"
testing "testing"
picol "github.com/dragonheim/gagent/pkg/picol/picol_unused"
)
@ -11,7 +11,7 @@ import (
func Test_RunPicol(t *testing.T) {
// Create a temporary test file
content := []byte("set a 5\nset b 7\n+ $a $b\n")
tmpfile, err := ioutil.TempFile("", "picol_test")
tmpfile, err := io.TempFile("", "picol_test")
if err != nil {
t.Fatalf("Error creating temporary test file: %v", err)
}