refactor(plugins): replace deprecated io/ioutil functions

The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2023-12-22 01:59:22 +08:00
parent e6953d60e9
commit 1d186a5a81
16 changed files with 32 additions and 41 deletions

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"regexp"
@@ -280,7 +280,7 @@ func DokkuApps() ([]string, error) {
func UnfilteredDokkuApps() ([]string, error) {
apps := []string{}
dokkuRoot := MustGetEnv("DOKKU_ROOT")
files, err := ioutil.ReadDir(dokkuRoot)
files, err := os.ReadDir(dokkuRoot)
if err != nil {
return apps, fmt.Errorf("You haven't deployed any applications yet")
}
@@ -517,7 +517,7 @@ func SuppressOutput(f errfunc) error {
err := f()
w.Close()
out, _ := ioutil.ReadAll(r)
out, _ := io.ReadAll(r)
os.Stdout = rescueStdout
if err != nil {