1
0
mirror of synced 2026-02-06 19:05:55 +00:00

chore: remove deprecated io/ioutil

Signed-off-by: Dmitry Rybin <ayrowa@yandex.ru>
This commit is contained in:
Dmitry Rybin
2021-07-30 20:49:44 +02:00
parent d40685ab62
commit 7f425efa6b
18 changed files with 30 additions and 45 deletions

View File

@@ -21,7 +21,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -304,7 +303,7 @@ func CompatibleVersion(binary, target string) bool {
}
func ExtractCRDs(inManifestPath, outManifestPath string) error {
manifests, err := ioutil.ReadFile(inManifestPath)
manifests, err := os.ReadFile(inManifestPath)
if err != nil {
return err
}
@@ -338,5 +337,5 @@ func ExtractCRDs(inManifestPath, outManifestPath string) error {
return fmt.Errorf("no CRDs found in %s", inManifestPath)
}
return ioutil.WriteFile(outManifestPath, []byte(crds), os.ModePerm)
return os.WriteFile(outManifestPath, []byte(crds), os.ModePerm)
}

View File

@@ -17,7 +17,6 @@ limitations under the License.
package utils
import (
"io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -134,7 +133,7 @@ func TestExtractCRDs(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Create temporary directory to write the result in.
dir, err := ioutil.TempDir("", "flux-TestExtractCRDs")
dir, err := os.MkdirTemp("", "flux-TestExtractCRDs")
if err != nil {
t.Fatalf("failed to create temporary directory: %v", err)
}