diff --git a/ci/pod/openfunction/function-example/test-body/hello.go b/ci/pod/openfunction/function-example/test-body/hello.go index ffa7fad6bd7e..df45e24a3269 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 f6253df3a729..54bceb4dac42 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) }