mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 16:21:44 +02:00
remove ioutil usage in all project
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
+1
-2
@@ -3,7 +3,6 @@ package app
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -87,7 +86,7 @@ func New(conf ConfigProvider) *App {
|
||||
}
|
||||
|
||||
func Init(app *App) *App {
|
||||
app.readFile = ioutil.ReadFile
|
||||
app.readFile = os.ReadFile
|
||||
app.deleteFile = os.Remove
|
||||
app.glob = filepath.Glob
|
||||
app.abs = filepath.Abs
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@ package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -52,7 +51,7 @@ func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepare
|
||||
// Create tmp directory and bail immediately if it fails
|
||||
var dir string
|
||||
if len(opts.OutputDir) == 0 {
|
||||
tempDir, err := ioutil.TempDir("", "helmfile*")
|
||||
tempDir, err := os.MkdirTemp("", "helmfile*")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
@@ -24,7 +23,7 @@ func assertEqualsToSnapshot(t *testing.T, name string, data string) {
|
||||
return
|
||||
}
|
||||
|
||||
wantData, err := ioutil.ReadFile(snapshotFileName)
|
||||
wantData, err := os.ReadFile(snapshotFileName)
|
||||
if err != nil {
|
||||
t.Fatalf(
|
||||
"Snapshot file %q does not exist. Rerun this test with `HELMFILE_UPDATE_SNAPSHOT=1 go test -v -run %s %s` to create the snapshot",
|
||||
@@ -53,7 +52,7 @@ func update(t *testing.T, snapshotFileName string, data []byte) {
|
||||
t.Fatalf("%v", err)
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(snapshotFileName, data, 0644); err != nil {
|
||||
if err := os.WriteFile(snapshotFileName, data, 0644); err != nil {
|
||||
t.Fatalf("%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user