Merge pull request #5973 from Juneezee/deprecate-ioutil

refactor: move from io/ioutil to io and os package
This commit is contained in:
Derek McGowan
2021-10-01 10:52:06 -07:00
committed by GitHub
126 changed files with 291 additions and 399 deletions

View File

@@ -19,7 +19,7 @@ package command
import (
gocontext "context"
"fmt"
"io/ioutil"
"io"
"net"
"os"
"os/signal"
@@ -55,7 +55,7 @@ high performance container runtime
func init() {
// Discard grpc logs so that they don't mess with our stdio
grpclog.SetLoggerV2(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
grpclog.SetLoggerV2(grpclog.NewLoggerV2(io.Discard, io.Discard, io.Discard))
cli.VersionPrinter = func(c *cli.Context) {
fmt.Println(c.App.Name, version.Package, c.App.Version, version.Revision)

View File

@@ -19,7 +19,6 @@ package command
import (
gocontext "context"
"io"
"io/ioutil"
"net"
"os"
"time"
@@ -73,7 +72,7 @@ var publishCommand = cli.Command{
}
func getEventPayload(r io.Reader) (*types.Any, error) {
data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
return nil, err
}

View File

@@ -18,7 +18,7 @@ package command
import (
"fmt"
"io/ioutil"
"io"
"log"
"os"
"path/filepath"
@@ -249,7 +249,7 @@ func registerUnregisterService(root string) (bool, error) {
return true, err
}
logOutput := ioutil.Discard
logOutput := io.Discard
if logFileFlag != "" {
f, err := os.OpenFile(logFileFlag, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {