This is an automated email from the ASF dual-hosted git repository.

monkeydluffy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new ce5986c4d chore: deprecate the package io/ioutil (#10444)
ce5986c4d is described below

commit ce5986c4dae5de942342e94ba52c0c3294f2adcc
Author: Meng Yan <[email protected]>
AuthorDate: Tue Nov 7 16:42:42 2023 +0800

    chore: deprecate the package io/ioutil (#10444)
---
 ci/pod/openfunction/function-example/test-body/hello.go |  5 +++--
 t/grpc_server_example/main.go                           | 10 ++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ci/pod/openfunction/function-example/test-body/hello.go 
b/ci/pod/openfunction/function-example/test-body/hello.go
index ffa7fad6b..df45e24a3 100644
--- a/ci/pod/openfunction/function-example/test-body/hello.go
+++ b/ci/pod/openfunction/function-example/test-body/hello.go
@@ -21,8 +21,9 @@ package hello
 
 import (
        "fmt"
+       "io"
        "net/http"
-       "io/ioutil"
+
        "github.com/OpenFunction/functions-framework-go/functions"
 )
 
@@ -31,6 +32,6 @@ func init() {
 }
 
 func HelloWorld(w http.ResponseWriter, r *http.Request) {
-       body,_ := ioutil.ReadAll(r.Body)
+       body, _ := io.ReadAll(r.Body)
        fmt.Fprintf(w, "Hello, %s!\n", string(body))
 }
diff --git a/t/grpc_server_example/main.go b/t/grpc_server_example/main.go
index f6253df3a..54bceb4da 100644
--- a/t/grpc_server_example/main.go
+++ b/t/grpc_server_example/main.go
@@ -30,10 +30,7 @@ import (
        "crypto/x509"
        "flag"
        "fmt"
-       "golang.org/x/net/http2"
-       "golang.org/x/net/http2/h2c"
        "io"
-       "io/ioutil"
        "log"
        "net"
        "net/http"
@@ -43,6 +40,9 @@ import (
        "syscall"
        "time"
 
+       "golang.org/x/net/http2"
+       "golang.org/x/net/http2/h2c"
+
        "google.golang.org/grpc"
        "google.golang.org/grpc/codes"
        "google.golang.org/grpc/credentials"
@@ -112,7 +112,6 @@ func (s *server) GetErrResp(ctx context.Context, in 
*pb.HelloRequest) (*pb.Hello
                Message: "The server is out of service",
                Type:    "service",
        })
-
        if err != nil {
                panic(fmt.Sprintf("Unexpected error attaching metadata: %v", 
err))
        }
@@ -121,7 +120,6 @@ func (s *server) GetErrResp(ctx context.Context, in 
*pb.HelloRequest) (*pb.Hello
 }
 
 func (s *server) SayHelloAfterDelay(ctx context.Context, in *pb.HelloRequest) 
(*pb.HelloReply, error) {
-
        select {
        case <-time.After(1 * time.Second):
                fmt.Println("overslept")
@@ -318,7 +316,7 @@ func main() {
                        }
 
                        certPool := x509.NewCertPool()
-                       ca, err := ioutil.ReadFile(caFilePath)
+                       ca, err := os.ReadFile(caFilePath)
                        if err != nil {
                                log.Fatalf("could not read ca certificate: %s", 
err)
                        }

Reply via email to