This is an automated email from the ASF dual-hosted git repository.

djwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-backup.git

commit 9a05ef17a92aac7b29276dcc2918ae4ab9be5ce6
Author: woblerr <[email protected]>
AuthorDate: Tue Apr 7 22:51:30 2026 +0300

    Replace deprecated io/ioutil.
    The io/ioutil package has been deprecated since Go 1.16. All usages are 
replaced with their recommended alternatives from os and io packages.
    Changes:
    - ioutil.ReadFile -> os.ReadFile
    - ioutil.WriteFile -> os.WriteFile
    - ioutil.TempFile -> os.CreateTemp
    - ioutil.TempDir -> os.MkdirTemp
    - ioutil.ReadAll -> io.ReadAll
    - ioutil.ReadDir -> os.ReadDir
    
    The os.ReadDir returns []os.DirEntry instead of []os.FileInfo, but all call 
sites only use .Name(), which is available on both interfaces.
---
 end_to_end/end_to_end_suite_test.go | 15 +++++++--------
 helper/restore_helper.go            |  3 +--
 history/history.go                  |  3 +--
 integration/helper_test.go          | 30 +++++++++++++++---------------
 integration/utils_test.go           |  3 +--
 options/options_test.go             |  9 ++++-----
 plugins/s3plugin/s3plugin.go        |  3 +--
 report/report_test.go               |  3 +--
 restore/wrappers_test.go            |  9 ++++-----
 toc/toc.go                          |  6 +++---
 utils/io.go                         |  5 ++---
 utils/io_test.go                    |  5 ++---
 utils/plugin_test.go                | 15 +++++++--------
 13 files changed, 49 insertions(+), 60 deletions(-)

diff --git a/end_to_end/end_to_end_suite_test.go 
b/end_to_end/end_to_end_suite_test.go
index 6a71a0d6..a9207097 100644
--- a/end_to_end/end_to_end_suite_test.go
+++ b/end_to_end/end_to_end_suite_test.go
@@ -6,7 +6,6 @@ import (
        "flag"
        "fmt"
        "io/fs"
-       "io/ioutil"
        "os"
        "os/exec"
        path "path/filepath"
@@ -362,7 +361,7 @@ func getMetdataFileContents(backupDir string, timestamp 
string, fileSuffix strin
        }
        file, err := path.Glob(path.Join(backupDir, filePath))
        Expect(err).ToNot(HaveOccurred())
-       fileContentBytes, err := ioutil.ReadFile(file[0])
+       fileContentBytes, err := os.ReadFile(file[0])
        Expect(err).ToNot(HaveOccurred())
 
        return fileContentBytes
@@ -695,7 +694,7 @@ func end_to_end_setup() {
        _ = os.Remove(historyFilePath)
 
        // Assign a unique directory for each test
-       backupDir, _ = ioutil.TempDir(customBackupDir, "temp")
+       backupDir, _ = os.MkdirTemp(customBackupDir, "temp")
 }
 
 func end_to_end_teardown() {
@@ -901,7 +900,7 @@ var _ = Describe("backup and restore end to end tests", 
func() {
                        Expect(files).To(HaveLen(2))
 
                        Expect(files[0]).To(HaveSuffix("_data"))
-                       contents, err := ioutil.ReadFile(files[0])
+                       contents, err := os.ReadFile(files[0])
                        Expect(err).ToNot(HaveOccurred())
                        tables := strings.Split(string(contents), "\n")
                        Expect(tables).To(Equal(expectedErrorTablesData))
@@ -909,7 +908,7 @@ var _ = Describe("backup and restore end to end tests", 
func() {
 
                        Expect(files).To(HaveLen(2))
                        Expect(files[1]).To(HaveSuffix("_metadata"))
-                       contents, err = ioutil.ReadFile(files[1])
+                       contents, err = os.ReadFile(files[1])
                        Expect(err).ToNot(HaveOccurred())
                        tables = strings.Split(string(contents), "\n")
                        sort.Strings(tables)
@@ -932,7 +931,7 @@ var _ = Describe("backup and restore end to end tests", 
func() {
                                "*-1/backups/*", "20190809230424", 
"*error_tables*"))
                        Expect(files).To(HaveLen(1))
                        Expect(files[0]).To(HaveSuffix("_metadata"))
-                       contents, err = ioutil.ReadFile(files[0])
+                       contents, err = os.ReadFile(files[0])
                        Expect(err).ToNot(HaveOccurred())
                        tables = strings.Split(string(contents), "\n")
                        sort.Strings(tables)
@@ -967,7 +966,7 @@ var _ = Describe("backup and restore end to end tests", 
func() {
                        Expect(files).To(HaveLen(1))
 
                        Expect(files[0]).To(HaveSuffix("_metadata"))
-                       contents, err := ioutil.ReadFile(files[0])
+                       contents, err := os.ReadFile(files[0])
                        Expect(err).ToNot(HaveOccurred())
                        tables := strings.Split(string(contents), "\n")
                        Expect(tables).To(Equal(expectedErrorTablesMetadata))
@@ -1598,7 +1597,7 @@ var _ = Describe("backup and restore end to end tests", 
func() {
                        Expect(err).ToNot(HaveOccurred())
                        Expect(configFile).To(HaveLen(1))
 
-                       contents, err := ioutil.ReadFile(configFile[0])
+                       contents, err := os.ReadFile(configFile[0])
                        Expect(err).ToNot(HaveOccurred())
 
                        
Expect(string(contents)).To(ContainSubstring("compressed: false"))
diff --git a/helper/restore_helper.go b/helper/restore_helper.go
index 50b32820..e0c67857 100644
--- a/helper/restore_helper.go
+++ b/helper/restore_helper.go
@@ -5,7 +5,6 @@ import (
        "compress/gzip"
        "fmt"
        "io"
-       "io/ioutil"
        "os"
        "os/exec"
        "path"
@@ -457,7 +456,7 @@ func startRestorePluginCommand(fileToRead string, objToc 
*toc.SegmentTOC, oidLis
        }
        cmdStr := ""
        if objToc != nil && pluginConfig.CanRestoreSubset() && *isFiltered && 
!strings.HasSuffix(fileToRead, ".gz") && !strings.HasSuffix(fileToRead, ".zst") 
{
-               offsetsFile, _ := ioutil.TempFile("/tmp", "gprestore_offsets_")
+               offsetsFile, _ := os.CreateTemp("/tmp", "gprestore_offsets_")
                defer func() {
                        offsetsFile.Close()
                }()
diff --git a/history/history.go b/history/history.go
index 05e1406e..1ee0c7ec 100644
--- a/history/history.go
+++ b/history/history.go
@@ -4,7 +4,6 @@ import (
        "database/sql"
        "errors"
        "fmt"
-       "io/ioutil"
        "os"
 
        "github.com/apache/cloudberry-backup/utils"
@@ -63,7 +62,7 @@ func (backup *BackupConfig) Failed() bool {
 
 func ReadConfigFile(filename string) *BackupConfig {
        config := &BackupConfig{}
-       contents, err := ioutil.ReadFile(filename)
+       contents, err := os.ReadFile(filename)
        gplog.FatalOnError(err)
        err = yaml.Unmarshal(contents, config)
        gplog.FatalOnError(err)
diff --git a/integration/helper_test.go b/integration/helper_test.go
index 31a79299..04ebf4ed 100644
--- a/integration/helper_test.go
+++ b/integration/helper_test.go
@@ -4,7 +4,7 @@ import (
        "bytes"
        "compress/gzip"
        "fmt"
-       "io/ioutil"
+       "io"
        "math"
        "os"
        "os/exec"
@@ -195,7 +195,7 @@ options:
                        setupRestoreFiles("", false)
                        helperCmd := gpbackupHelperRestore(gpbackupHelperPath, 
"--data-file", dataFileFullPath)
                        for _, i := range []int{1, 3} {
-                               contents, _ := 
ioutil.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
+                               contents, _ := 
os.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
                                Expect(string(contents)).To(Equal("here is some 
data\n"))
                        }
                        err := helperCmd.Wait()
@@ -207,7 +207,7 @@ options:
                        setupRestoreFiles("gzip", false)
                        helperCmd := gpbackupHelperRestore(gpbackupHelperPath, 
"--data-file", dataFileFullPath+".gz")
                        for _, i := range []int{1, 3} {
-                               contents, _ := 
ioutil.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
+                               contents, _ := 
os.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
                                Expect(string(contents)).To(Equal("here is some 
data\n"))
                        }
                        err := helperCmd.Wait()
@@ -219,7 +219,7 @@ options:
                        setupRestoreFiles("zstd", false)
                        helperCmd := gpbackupHelperRestore(gpbackupHelperPath, 
"--data-file", dataFileFullPath+".zst")
                        for _, i := range []int{1, 3} {
-                               contents, _ := 
ioutil.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
+                               contents, _ := 
os.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
                                Expect(string(contents)).To(Equal("here is some 
data\n"))
                        }
                        err := helperCmd.Wait()
@@ -231,7 +231,7 @@ options:
                        setupRestoreFiles("", true)
                        helperCmd := gpbackupHelperRestore(gpbackupHelperPath, 
"--data-file", dataFileFullPath, "--plugin-config", examplePluginTestConfig)
                        for _, i := range []int{1, 3} {
-                               contents, _ := 
ioutil.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
+                               contents, _ := 
os.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
                                Expect(string(contents)).To(Equal("here is some 
data\n"))
                        }
                        err := helperCmd.Wait()
@@ -243,7 +243,7 @@ options:
                        setupRestoreFiles("gzip", true)
                        helperCmd := gpbackupHelperRestore(gpbackupHelperPath, 
"--data-file", dataFileFullPath+".gz", "--plugin-config", 
examplePluginTestConfig)
                        for _, i := range []int{1, 3} {
-                               contents, _ := 
ioutil.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
+                               contents, _ := 
os.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
                                Expect(string(contents)).To(Equal("here is some 
data\n"))
                        }
                        err := helperCmd.Wait()
@@ -255,7 +255,7 @@ options:
                        setupRestoreFiles("zstd", true)
                        helperCmd := gpbackupHelperRestore(gpbackupHelperPath, 
"--data-file", dataFileFullPath+".zst", "--plugin-config", 
examplePluginTestConfig)
                        for _, i := range []int{1, 3} {
-                               contents, _ := 
ioutil.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
+                               contents, _ := 
os.ReadFile(fmt.Sprintf("%s_%d_0", pipeFile, i))
                                Expect(string(contents)).To(Equal("here is some 
data\n"))
                        }
                        err := helperCmd.Wait()
@@ -329,7 +329,7 @@ options:
                                        errClose := file.Close()
                                        Expect(errClose).ToNot(HaveOccurred())
                                } else {
-                                       contents, err := 
ioutil.ReadFile(currentPipe)
+                                       contents, err := 
os.ReadFile(currentPipe)
                                        Expect(err).ToNot(HaveOccurred())
                                        Expect(string(contents)).To(Equal("here 
is some data\n"))
                                }
@@ -404,11 +404,11 @@ func assertBackupArtifacts(withPlugin bool) {
        if withPlugin {
                dataFile = examplePluginTestDataFile
        }
-       contents, err = ioutil.ReadFile(dataFile)
+       contents, err = os.ReadFile(dataFile)
        Expect(err).ToNot(HaveOccurred())
        Expect(string(contents)).To(Equal(expectedData))
 
-       contents, err = ioutil.ReadFile(tocFile)
+       contents, err = os.ReadFile(tocFile)
        Expect(err).ToNot(HaveOccurred())
        Expect(string(contents)).To(Equal(expectedTOC))
        assertNoErrors()
@@ -424,9 +424,9 @@ func assertBackupArtifactsWithCompression(compressionType 
string, withPlugin boo
        }
 
        if compressionType == "gzip" {
-               contents, err = ioutil.ReadFile(dataFile + ".gz")
+               contents, err = os.ReadFile(dataFile + ".gz")
        } else if compressionType == "zstd" {
-               contents, err = ioutil.ReadFile(dataFile + ".zst")
+               contents, err = os.ReadFile(dataFile + ".zst")
        } else {
                Fail("unknown compression type " + compressionType)
        }
@@ -434,16 +434,16 @@ func assertBackupArtifactsWithCompression(compressionType 
string, withPlugin boo
 
        if compressionType == "gzip" {
                r, _ := gzip.NewReader(bytes.NewReader(contents))
-               contents, _ = ioutil.ReadAll(r)
+               contents, _ = io.ReadAll(r)
        } else if compressionType == "zstd" {
                r, _ := zstd.NewReader(bytes.NewReader(contents))
-               contents, _ = ioutil.ReadAll(r)
+               contents, _ = io.ReadAll(r)
        } else {
                Fail("unknown compression type " + compressionType)
        }
        Expect(string(contents)).To(Equal(expectedData))
 
-       contents, err = ioutil.ReadFile(tocFile)
+       contents, err = os.ReadFile(tocFile)
        Expect(err).ToNot(HaveOccurred())
        Expect(string(contents)).To(Equal(expectedTOC))
 
diff --git a/integration/utils_test.go b/integration/utils_test.go
index efeabab0..9228e5a7 100644
--- a/integration/utils_test.go
+++ b/integration/utils_test.go
@@ -2,7 +2,6 @@ package integration
 
 import (
        "fmt"
-       "io/ioutil"
        "os"
        "path/filepath"
        "time"
@@ -21,7 +20,7 @@ import (
 
 var _ = Describe("utils integration", func() {
        It("TerminateHangingCopySessions stops hanging COPY sessions", func() {
-               tempDir, err := ioutil.TempDir("", "temp")
+               tempDir, err := os.MkdirTemp("", "temp")
                Expect(err).To(Not(HaveOccurred()))
                defer os.Remove(tempDir)
                testPipe := filepath.Join(tempDir, "test_pipe")
diff --git a/options/options_test.go b/options/options_test.go
index 396c572b..fef85568 100644
--- a/options/options_test.go
+++ b/options/options_test.go
@@ -1,7 +1,6 @@
 package options_test
 
 import (
-       "io/ioutil"
        "os"
 
        "github.com/DATA-DOG/go-sqlmock"
@@ -70,7 +69,7 @@ var _ = Describe("options", func() {
                        Expect(includedTables[1]).To(Equal("bar.baz"))
                })
                It("returns the text-file tables when specified", func() {
-                       file, err := ioutil.TempFile("/tmp", 
"gpbackup_test_options*.txt")
+                       file, err := os.CreateTemp("/tmp", 
"gpbackup_test_options*.txt")
                        Expect(err).To(Not(HaveOccurred()))
                        defer func() {
                                _ = os.Remove(file.Name())
@@ -93,7 +92,7 @@ var _ = Describe("options", func() {
                        Expect(includedTables[1]).To(Equal("myschema.mytable2"))
                })
                It("sets the INCLUDE_RELATIONS flag from file", func() {
-                       file, err := ioutil.TempFile("/tmp", 
"gpbackup_test_options*.txt")
+                       file, err := os.CreateTemp("/tmp", 
"gpbackup_test_options*.txt")
                        Expect(err).To(Not(HaveOccurred()))
                        defer func() {
                                _ = os.Remove(file.Name())
@@ -117,7 +116,7 @@ var _ = Describe("options", func() {
                        Expect(includedTables[1]).To(Equal("myschema.mytable2"))
                })
                It("skips empty lines in files provided for filtering tables", 
func() {
-                       file, err := ioutil.TempFile("/tmp", 
"gpbackup_test_options*.txt")
+                       file, err := os.CreateTemp("/tmp", 
"gpbackup_test_options*.txt")
                        Expect(err).To(Not(HaveOccurred()))
                        defer func() {
                                _ = os.Remove(file.Name())
@@ -150,7 +149,7 @@ var _ = Describe("options", func() {
                        Expect(excludedTables[1]).To(Equal("myschema.mytable2"))
                })
                It("skips empty lines in files provided for filtering schemas", 
func() {
-                       file, err := ioutil.TempFile("/tmp", 
"gpbackup_test_options*.txt")
+                       file, err := os.CreateTemp("/tmp", 
"gpbackup_test_options*.txt")
                        Expect(err).To(Not(HaveOccurred()))
                        defer func() {
                                _ = os.Remove(file.Name())
diff --git a/plugins/s3plugin/s3plugin.go b/plugins/s3plugin/s3plugin.go
index 501bad08..f1b43d56 100644
--- a/plugins/s3plugin/s3plugin.go
+++ b/plugins/s3plugin/s3plugin.go
@@ -3,7 +3,6 @@ package s3plugin
 import (
        "errors"
        "fmt"
-       "io/ioutil"
        "net/http"
        "net/url"
        "os"
@@ -95,7 +94,7 @@ func GetAPIVersion(c *cli.Context) {
 
 func readAndValidatePluginConfig(configFile string) (*PluginConfig, error) {
        config := &PluginConfig{}
-       contents, err := ioutil.ReadFile(configFile)
+       contents, err := os.ReadFile(configFile)
        if err != nil {
                return nil, err
        }
diff --git a/report/report_test.go b/report/report_test.go
index 0d2f6409..e53cc2de 100644
--- a/report/report_test.go
+++ b/report/report_test.go
@@ -3,7 +3,6 @@ package report_test
 import (
        "fmt"
        "io"
-       "io/ioutil"
        "os"
        "strings"
        "testing"
@@ -480,7 +479,7 @@ Timestamp Key: 20170101010101`)
                        testCluster = testutils.SetDefaultSegmentConfiguration()
                        testFPInfo = filepath.NewFilePathInfo(testCluster, "", 
"20170101010101", "gpseg", false)
                        operating.System.OpenFileRead = func(name string, flag 
int, perm os.FileMode) (operating.ReadCloserAt, error) { return r, nil }
-                       operating.System.ReadFile = func(filename string) 
([]byte, error) { return ioutil.ReadAll(r) }
+                       operating.System.ReadFile = func(filename string) 
([]byte, error) { return io.ReadAll(r) }
                        operating.System.Hostname = func() (string, error) { 
return "localhost", nil }
                        operating.System.Getenv = func(key string) string {
                                if key == "HOME" {
diff --git a/restore/wrappers_test.go b/restore/wrappers_test.go
index 88eea0cd..86635f5e 100644
--- a/restore/wrappers_test.go
+++ b/restore/wrappers_test.go
@@ -2,7 +2,6 @@ package restore_test
 
 import (
        "fmt"
-       "io/ioutil"
        "os"
        "path/filepath"
 
@@ -236,9 +235,9 @@ timestamp: "20180415154238"
 withstatistics: false
 `, dbVersion)
 
-                       tempDir, _ = ioutil.TempDir("", "temp")
+                       tempDir, _ = os.MkdirTemp("", "temp")
 
-                       err := ioutil.WriteFile(testConfigPath, 
[]byte(sampleConfigContents), 0777)
+                       err := os.WriteFile(testConfigPath, 
[]byte(sampleConfigContents), 0777)
                        Expect(err).ToNot(HaveOccurred())
                        err = cmdFlags.Set(options.PLUGIN_CONFIG, 
testConfigPath)
                        Expect(err).ToNot(HaveOccurred())
@@ -286,7 +285,7 @@ withstatistics: false
                        configDir := filepath.Join(mdd, 
"backups/20170101/20170101010101/")
                        _ = os.MkdirAll(configDir, 0777)
                        configPath := filepath.Join(configDir, 
"gpbackup_20170101010101_config.yaml")
-                       err = ioutil.WriteFile(configPath, 
[]byte(sampleBackupConfig), 0777)
+                       err = os.WriteFile(configPath, 
[]byte(sampleBackupConfig), 0777)
                        Expect(err).ToNot(HaveOccurred())
 
                        restore.SetVersion("1.11.0+dev.28.g10571fd")
@@ -298,7 +297,7 @@ withstatistics: false
                        _ = os.Remove(testConfigPath)
                        confDir := filepath.Dir(testConfigPath)
                        confFileName := filepath.Base(testConfigPath)
-                       files, _ := ioutil.ReadDir(confDir)
+                       files, _ := os.ReadDir(confDir)
                        for _, f := range files {
                                match, _ := 
filepath.Match("*"+confFileName+"*", f.Name())
                                if match {
diff --git a/toc/toc.go b/toc/toc.go
index 42d727ca..32cb913a 100644
--- a/toc/toc.go
+++ b/toc/toc.go
@@ -3,7 +3,7 @@ package toc
 import (
        "fmt"
        "io"
-       "io/ioutil"
+       "os"
        "regexp"
        "strings"
 
@@ -128,7 +128,7 @@ const (
 
 func NewTOC(filename string) *TOC {
        toc := &TOC{}
-       contents, err := ioutil.ReadFile(filename)
+       contents, err := os.ReadFile(filename)
        gplog.FatalOnError(err)
        err = yaml.Unmarshal(contents, toc)
        gplog.FatalOnError(err)
@@ -137,7 +137,7 @@ func NewTOC(filename string) *TOC {
 
 func NewSegmentTOC(filename string) *SegmentTOC {
        toc := &SegmentTOC{}
-       contents, err := ioutil.ReadFile(filename)
+       contents, err := os.ReadFile(filename)
        gplog.FatalOnError(err)
        err = yaml.Unmarshal(contents, toc)
        gplog.FatalOnError(err)
diff --git a/utils/io.go b/utils/io.go
index a425b9c2..b2cdce1f 100644
--- a/utils/io.go
+++ b/utils/io.go
@@ -8,7 +8,6 @@ package utils
 import (
        "fmt"
        "io"
-       "io/ioutil"
        "os"
 
        "github.com/apache/cloudberry-go-libs/gplog"
@@ -90,12 +89,12 @@ func CopyFile(src, dest string) error {
        info, err := os.Stat(src)
        if err == nil {
                var content []byte
-               content, err = ioutil.ReadFile(src)
+               content, err = os.ReadFile(src)
                if err != nil {
                        gplog.Error("Error: %v, encountered when reading file: 
%s", err, src)
                        return err
                }
-               return ioutil.WriteFile(dest, content, info.Mode())
+               return os.WriteFile(dest, content, info.Mode())
        }
        gplog.Error("Error: %v, encountered when trying to stat file: %s", err, 
src)
        return err
diff --git a/utils/io_test.go b/utils/io_test.go
index 17f9ce61..3756dc6c 100644
--- a/utils/io_test.go
+++ b/utils/io_test.go
@@ -1,7 +1,6 @@
 package utils_test
 
 import (
-       "io/ioutil"
        "os"
 
        "github.com/apache/cloudberry-backup/utils"
@@ -62,12 +61,12 @@ var _ = Describe("utils/io tests", func() {
                        _ = os.Remove(destFilePath)
                })
                It("copies source file to dest file", func() {
-                       _ = ioutil.WriteFile(sourceFilePath, []byte{1, 2, 3, 
4}, 0777)
+                       _ = os.WriteFile(sourceFilePath, []byte{1, 2, 3, 4}, 
0777)
 
                        err := utils.CopyFile(sourceFilePath, destFilePath)
 
                        Expect(err).ToNot(HaveOccurred())
-                       contents, _ := ioutil.ReadFile(destFilePath)
+                       contents, _ := os.ReadFile(destFilePath)
                        Expect(contents).To(Equal([]byte{1, 2, 3, 4}))
                })
                It("returns an err when cannot read source file", func() {
diff --git a/utils/plugin_test.go b/utils/plugin_test.go
index b292cde6..2fc22cf9 100644
--- a/utils/plugin_test.go
+++ b/utils/plugin_test.go
@@ -2,7 +2,6 @@ package utils_test
 
 import (
        "fmt"
-       "io/ioutil"
        "os"
        "path/filepath"
        "regexp"
@@ -29,7 +28,7 @@ var _ = Describe("utils/plugin tests", func() {
 
        BeforeEach(func() {
                operating.InitializeSystemFunctions()
-               tempDir, _ = ioutil.TempDir("", "temp")
+               tempDir, _ = os.MkdirTemp("", "temp")
                operating.System.Stdout = stdout
                subject = utils.PluginConfig{
                        ExecutablePath: "/a/b/myPlugin",
@@ -68,7 +67,7 @@ var _ = Describe("utils/plugin tests", func() {
                _ = os.Remove(subject.ConfigPath)
                confDir := filepath.Dir(subject.ConfigPath)
                confFileName := filepath.Base(subject.ConfigPath)
-               files, _ := ioutil.ReadDir(confDir)
+               files, _ := os.ReadDir(confDir)
                for _, f := range files {
                        match, _ := filepath.Match(confFileName+"*", f.Name())
                        if match {
@@ -110,7 +109,7 @@ options:
     field2: hello
     field3: 567
 `
-                       err := ioutil.WriteFile(testConfigPath, 
[]byte(testConfigContents), 0777)
+                       err := os.WriteFile(testConfigPath, 
[]byte(testConfigContents), 0777)
                        Expect(err).To(Not(HaveOccurred()))
                        subject.SetBackupPluginVersion("myTimestamp", 
"my.test.version")
                        subject.CopyPluginConfigToAllHosts(testCluster)
@@ -157,7 +156,7 @@ options:
     field2: hello
     field3: 567
 `
-                               err := ioutil.WriteFile(testConfigPath, 
[]byte(testConfigContents), 0777)
+                               err := os.WriteFile(testConfigPath, 
[]byte(testConfigContents), 0777)
                                subject.Options["password_encryption"] = "on"
                                mdd := testCluster.GetDirForContent(-1)
                                _ = os.MkdirAll(mdd, 0777)
@@ -286,7 +285,7 @@ options:
                        mdd := testCluster.GetDirForContent(-1)
                        _ = os.MkdirAll(mdd, 0777)
                        secretFilePath := filepath.Join(mdd, 
utils.SecretKeyFile)
-                       err := ioutil.WriteFile(secretFilePath, 
[]byte(`gpbackup_fake_plugin: 0123456789`), 0777)
+                       err := os.WriteFile(secretFilePath, 
[]byte(`gpbackup_fake_plugin: 0123456789`), 0777)
                        Expect(err).To(Not(HaveOccurred()))
 
                        key, err := utils.GetSecretKey("gpbackup_fake_plugin", 
mdd)
@@ -307,7 +306,7 @@ options:
                        mdd := testCluster.GetDirForContent(-1)
                        _ = os.MkdirAll(mdd, 0777)
                        secretFilePath := filepath.Join(mdd, 
utils.SecretKeyFile)
-                       err := ioutil.WriteFile(secretFilePath, []byte(""), 
0777)
+                       err := os.WriteFile(secretFilePath, []byte(""), 0777)
                        Expect(err).To(Not(HaveOccurred()))
 
                        pluginName := "gpbackup_fake_plugin"
@@ -320,7 +319,7 @@ options:
                        mdd := testCluster.GetDirForContent(-1)
                        _ = os.MkdirAll(mdd, 0777)
                        secretFilePath := filepath.Join(mdd, 
utils.SecretKeyFile)
-                       err := ioutil.WriteFile(secretFilePath, 
[]byte("improperlyFormattedYaml"), 0777)
+                       err := os.WriteFile(secretFilePath, 
[]byte("improperlyFormattedYaml"), 0777)
                        Expect(err).To(Not(HaveOccurred()))
 
                        pluginName := "gpbackup_fake_plugin"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to