diff --git a/providers/fs/fs.go b/providers/fs/fs.go index 0df2de04..c008b427 100644 --- a/providers/fs/fs.go +++ b/providers/fs/fs.go @@ -9,8 +9,8 @@ package fs import ( "errors" - "io" "io/fs" + "io/ioutil" ) // FS implements an fs.FS provider. @@ -32,7 +32,7 @@ func (f *FS) ReadBytes() ([]byte, error) { } defer fd.Close() - return io.ReadAll(fd) + return ioutil.ReadAll(fd) } // Read is not supported by the fs.FS provider. diff --git a/providers/s3/s3.go b/providers/s3/s3.go index 4c7c7e2f..13e63436 100644 --- a/providers/s3/s3.go +++ b/providers/s3/s3.go @@ -4,7 +4,7 @@ package s3 import ( "errors" - "io" + "io/ioutil" "github.com/rhnvrm/simples3" ) @@ -56,7 +56,7 @@ func (r *S3) ReadBytes() ([]byte, error) { defer resp.Close() - data, err := io.ReadAll(resp) + data, err := ioutil.ReadAll(resp) if err != nil { return nil, err } diff --git a/tests/koanf_test.go b/tests/koanf_test.go index ddc96fba..bd2bd509 100644 --- a/tests/koanf_test.go +++ b/tests/koanf_test.go @@ -5,6 +5,7 @@ import ( "errors" "flag" "fmt" + "io/ioutil" "log" "os" "path/filepath" @@ -437,9 +438,9 @@ func TestWatchFile(t *testing.T) { ) // Create a tmp config file. - tmpDir := t.TempDir() + tmpDir, _ := ioutil.TempDir("", "koanf_*") // TODO: replace with t.TempDir() as of go v1.15 tmpFile := filepath.Join(tmpDir, "koanf_mock") - err := os.WriteFile(tmpFile, []byte(`{"parent": {"name": "name1"}}`), 0600) + err := ioutil.WriteFile(tmpFile, []byte(`{"parent": {"name": "name1"}}`), 0600) // TODO: replace with os.WriteFile as of go v1.16 require.NoError(t, err, "error creating temp config file: %v", err) // Load the new config and watch it for changes. @@ -468,7 +469,7 @@ func TestWatchFile(t *testing.T) { // Wait a second and change the file. time.Sleep(1 * time.Second) - os.WriteFile(tmpFile, []byte(`{"parent": {"name": "name2"}}`), 0600) + ioutil.WriteFile(tmpFile, []byte(`{"parent": {"name": "name2"}}`), 0600) // TODO: replace with os.WriteFile as of go v1.16 wg.Wait() assert.Condition(func() bool { @@ -481,7 +482,7 @@ func TestWatchFileSymlink(t *testing.T) { assert = assert.New(t) k = koanf.New(delim) ) - tmpDir := t.TempDir() + tmpDir, _ := ioutil.TempDir("", "koanf_*") // TODO: replace with t.TempDir() as of go v1.15 // Create a symlink. symPath := filepath.Join(tmpDir, "koanf_test_symlink")