Refactor: move from io/ioutil to io and os package (#2234)

The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <zerjun@beatchain.co>
This commit is contained in:
Eng Zer Jun
2021-09-06 18:33:42 +08:00
committed by GitHub
parent f8ac24db27
commit 426aa7af34
49 changed files with 143 additions and 171 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ package plugin
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"time"
@@ -51,7 +51,7 @@ var _ = Describe("Test Kubectl Plugin", func() {
}, 5*time.Second).Should(BeNil())
By("dry-run application")
err := ioutil.WriteFile("dry-run-app.yaml", []byte(application), 0644)
err := os.WriteFile("dry-run-app.yaml", []byte(application), 0644)
Expect(err).NotTo(HaveOccurred())
output, err := e2e.Exec("kubectl-vela dry-run -f dry-run-app.yaml -n vela-system")
Expect(err).NotTo(HaveOccurred())
@@ -91,7 +91,7 @@ var _ = Describe("Test Kubectl Plugin", func() {
}, 5*time.Second).Should(BeNil())
By("live-diff application")
err := ioutil.WriteFile("live-diff-app.yaml", []byte(newApplication), 0644)
err := os.WriteFile("live-diff-app.yaml", []byte(newApplication), 0644)
Expect(err).NotTo(HaveOccurred())
output, err := e2e.Exec("kubectl-vela live-diff -f live-diff-app.yaml")
Expect(err).NotTo(HaveOccurred())