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

@ -4,7 +4,6 @@ import (
sha "crypto/sha256"
hex "encoding/hex"
fmt "fmt"
ioutil "io/ioutil"
log "log"
os "os"
regexp "regexp"
@ -34,7 +33,7 @@ func Main(wg *sync.WaitGroup, config gs.GagentConfig) {
var err error
if config.CMode {
agent.Script, err = ioutil.ReadFile(config.Agent)
agent.Script, err = os.ReadFile(config.Agent)
if err != nil {
log.Printf("[ERROR] No such file or directory: %s", config.Agent)
os.Exit(4)

View file

@ -1,13 +1,13 @@
package client
import (
"bytes"
"errors"
"io/ioutil"
"log"
"os"
"sync"
"testing"
bytes "bytes"
errors "errors"
io "io"
log "log"
os "os"
sync "sync"
testing "testing"
gs "github.com/dragonheim/gagent/internal/gstructs"
@ -107,7 +107,7 @@ func equalStringSlices(a, b []string) bool {
func TestMain(t *testing.T) {
// Prepare a temporary agent file for testing
tmpAgentFile, err := ioutil.TempFile("", "agent")
tmpAgentFile, err := io.TempFile("", "agent")
if err != nil {
t.Fatal(err)
}