mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 06:15:40 +00:00
delete io/ioutil package. (#5955)
Signed-off-by: yanggang <gang.yang@daocloud.io>
This commit is contained in:
@@ -19,7 +19,7 @@ package backuplocation
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -141,7 +141,7 @@ func (o *CreateOptions) BuildBackupStorageLocation(namespace string, setBackupSy
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
caCertData, err = ioutil.ReadFile(realPath)
|
||||
caCertData, err = os.ReadFile(realPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package backuplocation
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -98,7 +98,7 @@ func (o *SetOptions) Run(c *cobra.Command, f client.Factory) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
caCertData, err = ioutil.ReadFile(realPath)
|
||||
caCertData, err = os.ReadFile(realPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
@@ -91,7 +90,7 @@ func (o *option) complete(f client.Factory, fs *pflag.FlagSet) error {
|
||||
return fmt.Errorf("invalid output path: %v", err)
|
||||
}
|
||||
o.outputPath = absOutputPath
|
||||
tmpDir, err := ioutil.TempDir("", "crashd")
|
||||
tmpDir, err := os.MkdirTemp("", "crashd")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package install
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -156,7 +155,7 @@ func (o *InstallOptions) AsVeleroOptions() (*install.VeleroOptions, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
secretData, err = ioutil.ReadFile(realPath)
|
||||
secretData, err = os.ReadFile(realPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -167,7 +166,7 @@ func (o *InstallOptions) AsVeleroOptions() (*install.VeleroOptions, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
caCertData, err = ioutil.ReadFile(realPath)
|
||||
caCertData, err = os.ReadFile(realPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -327,7 +326,7 @@ func (o *InstallOptions) Run(c *cobra.Command, f client.Factory) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//Complete completes options for a command.
|
||||
// Complete completes options for a command.
|
||||
func (o *InstallOptions) Complete(args []string, f client.Factory) error {
|
||||
o.Namespace = f.Namespace()
|
||||
return nil
|
||||
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
@@ -91,7 +91,7 @@ func Stream(ctx context.Context, kbClient kbclient.Client, namespace, name strin
|
||||
|
||||
var caPool *x509.CertPool
|
||||
if len(caCertFile) > 0 {
|
||||
caCert, err := ioutil.ReadFile(caCertFile)
|
||||
caCert, err := os.ReadFile(caCertFile)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "couldn't open cacert")
|
||||
}
|
||||
@@ -140,7 +140,7 @@ func Stream(ctx context.Context, kbClient kbclient.Client, namespace, name strin
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "request failed: unable to decode response body")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user