chore: remove deprecated io/ioutil
Signed-off-by: Dmitry Rybin <ayrowa@yandex.ru>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user