Skip to content

Commit

Permalink
chore: deprecate the package io/ioutil (apache#10444)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanmxa authored Nov 7, 2023
1 parent 266ace7 commit ce5986c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions ci/pod/openfunction/function-example/test-body/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ package hello

import (
"fmt"
"io"
"net/http"
"io/ioutil"

"github.com/OpenFunction/functions-framework-go/functions"
)

Expand All @@ -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))
}
10 changes: 4 additions & 6 deletions t/grpc_server_example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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))
}
Expand All @@ -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")
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit ce5986c

Please sign in to comment.