chore: remove refs to deprecated io/ioutil (#3811)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
1 parent
70118882a0
commit
8bb6632512
4 files changed
+7
-10
No files matched your search
@@ -6,7 +6,6 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@@ -173,7 +172,7 @@ func fillTemplates() {
|
||||
if _, err := os.Stat(outDir); os.IsNotExist(err) {
|
||||
_ = os.Mkdir(outDir, os.ModePerm)
|
||||
}
|
||||
if err := ioutil.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
if err := os.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
fmt.Printf("error writing file %q: %v\n", outFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -216,7 +215,7 @@ func fillTemplates() {
|
||||
if _, err := os.Stat(outDir); os.IsNotExist(err) {
|
||||
_ = os.Mkdir(outDir, os.ModePerm)
|
||||
}
|
||||
if err := ioutil.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
if err := os.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
fmt.Printf("error writing file %q: %v\n", outFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
@@ -36,7 +35,7 @@ func fillTemplates() {
|
||||
if _, err := os.Stat(outDir); os.IsNotExist(err) {
|
||||
_ = os.Mkdir(outDir, os.ModePerm)
|
||||
}
|
||||
if err := ioutil.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
if err := os.WriteFile(outFile, outBuf.Bytes(), 0o644); err != nil {
|
||||
fmt.Printf("error writing file %q: %v\n", outFile, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
// name
|
||||
func CloudEventFromFile(t testing.TB, fileName string) *cloudevents.Event {
|
||||
t.Helper()
|
||||
b, err := ioutil.ReadFile(fileName)
|
||||
b, err := os.ReadFile(fileName)
|
||||
assert.NoError(t, err)
|
||||
got := &cloudevents.Event{}
|
||||
err = json.Unmarshal(b, got)
|
||||
|
||||
@@ -5,7 +5,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -84,7 +83,7 @@ func main() {
|
||||
worker,
|
||||
)
|
||||
|
||||
fileContents, err := ioutil.ReadFile(permsFile)
|
||||
fileContents, err := os.ReadFile(permsFile)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
@@ -120,7 +119,7 @@ func main() {
|
||||
strings.Join(table.Marshal(), "\n"),
|
||||
strings.Join(post, "\n"))
|
||||
|
||||
if err := ioutil.WriteFile(permsFile, []byte(final), 0o644); err != nil {
|
||||
if err := os.WriteFile(permsFile, []byte(final), 0o644); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user