mirror of
https://github.com/dragonheim/gagent.git
synced 2025-04-29 00:08:59 -07:00
fix: Replaced ioutil as it was deprecated in Golang.
This commit is contained in:
parent
82a964fc50
commit
97c8af8816
18 changed files with 105 additions and 114 deletions
|
@ -3,8 +3,8 @@ package chaindb
|
|||
import (
|
||||
sha256 "crypto/sha256"
|
||||
fmt "fmt"
|
||||
ioutil "io/ioutil"
|
||||
log "log"
|
||||
os "os"
|
||||
time "time"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
|
@ -70,7 +70,7 @@ func (db *GagentDb) WriteHCL(ChainDBPath string) error {
|
|||
agentBody.SetAttributeValue("version", cty.StringVal(row.Agent.Shasum))
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(ChainDBPath, f.Bytes(), 0600)
|
||||
return os.WriteFile(ChainDBPath, f.Bytes(), 0600)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package chaindb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
bytes "bytes"
|
||||
os "os"
|
||||
testing "testing"
|
||||
time "time"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gstructs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
fmt "fmt"
|
||||
)
|
||||
|
||||
type AgentStatus []string
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package gstructs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
testing "testing"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
"github.com/stretchr/testify/assert"
|
||||
assert "github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetByIndex(t *testing.T) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package gstructs_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
testing "testing"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
)
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package router_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
http "net/http"
|
||||
httptest "net/http/httptest"
|
||||
sync "sync"
|
||||
testing "testing"
|
||||
time "time"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
"github.com/dragonheim/gagent/internal/router"
|
||||
router "github.com/dragonheim/gagent/internal/router"
|
||||
)
|
||||
|
||||
func TestRouterMain(t *testing.T) {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package setup_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
bytes "bytes"
|
||||
io "io"
|
||||
log "log"
|
||||
os "os"
|
||||
testing "testing"
|
||||
|
||||
"strings"
|
||||
"sync"
|
||||
strings "strings"
|
||||
sync "sync"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
"github.com/dragonheim/gagent/internal/setup"
|
||||
setup "github.com/dragonheim/gagent/internal/setup"
|
||||
)
|
||||
|
||||
func TestSetupMain(t *testing.T) {
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package worker_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
bytes "bytes"
|
||||
io "io"
|
||||
log "log"
|
||||
os "os"
|
||||
testing "testing"
|
||||
|
||||
"strings"
|
||||
"sync"
|
||||
strings "strings"
|
||||
sync "sync"
|
||||
|
||||
gs "github.com/dragonheim/gagent/internal/gstructs"
|
||||
|
||||
"github.com/dragonheim/gagent/internal/worker"
|
||||
worker "github.com/dragonheim/gagent/internal/worker"
|
||||
)
|
||||
|
||||
func TestWorkerMain(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue