1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

removed references to deprecated ioutil

This commit is contained in:
postmannen 2022-09-06 10:59:07 +02:00
parent f5e5e4337e
commit 3cf8bd2ce8
3 changed files with 4 additions and 7 deletions

View file

@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"
@ -146,7 +145,7 @@ func (s *server) getFilePaths(dirName string) ([]string, error) {
}
}
fInfo, err := ioutil.ReadDir(dirPath)
fInfo, err := os.ReadDir(dirPath)
if err != nil {
er := fmt.Errorf("error: failed to get filenames in startup folder: %v", err)
return nil, er

View file

@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
@ -16,7 +15,7 @@ import (
// nodeAuth is the structure that holds both keys and acl's
// that the running steward node shall use for authorization.
//It holds a mutex to use when interacting with the map.
// It holds a mutex to use when interacting with the map.
type nodeAuth struct {
// ACL that defines where a node is allowed to recieve from.
nodeAcl *nodeAcl
@ -361,7 +360,7 @@ func (n *nodeAuth) readKeyFile(keyFile string) (ed2519key []byte, b64Key []byte,
}
defer fh.Close()
b, err := ioutil.ReadAll(fh)
b, err := io.ReadAll(fh)
if err != nil {
er := fmt.Errorf("error: failed to read key file: %v", err)
return nil, nil, er

3
tui.go
View file

@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
@ -805,7 +804,7 @@ func (t *tui) console(app *tview.Application) tview.Primitive {
// the messages folder.
func (t *tui) getMessageNames(outputForm *tview.TextView) []string {
// Create messages dropdown field.
fInfo, err := ioutil.ReadDir("messages")
fInfo, err := os.ReadDir("messages")
if err != nil {
fmt.Fprintf(outputForm, "error: failed to read files from messages dir\n")
}