From 2165f5bd0c71b603012694155a284b0c5fd38039 Mon Sep 17 00:00:00 2001 From: William Collishaw Date: Sat, 28 Feb 2026 14:30:56 -0700 Subject: [PATCH] fix: replaces usage of deprecated io/ioutil --- .../lambda-managed-instances/testdata/env_setup_helpers.go | 3 +-- internal/lambda-managed-instances/testdata/flowtesting.go | 4 ++-- internal/lambda/rie/handlers.go | 4 ++-- internal/lambda/testdata/flowtesting.go | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/lambda-managed-instances/testdata/env_setup_helpers.go b/internal/lambda-managed-instances/testdata/env_setup_helpers.go index a3b733e..37b7348 100644 --- a/internal/lambda-managed-instances/testdata/env_setup_helpers.go +++ b/internal/lambda-managed-instances/testdata/env_setup_helpers.go @@ -6,7 +6,6 @@ package testdata import ( "bytes" "fmt" - "io/ioutil" "net" "os" "os/exec" @@ -30,7 +29,7 @@ func CreateTestSocketPair(t *testing.T) (fd [2]int) { } func CreateTestLogFile(t *testing.T) *os.File { - file, err := ioutil.TempFile(os.TempDir(), "rapid-unit-tests") + file, err := os.CreateTemp(os.TempDir(), "rapid-unit-tests") assert.NoError(t, err, "error opening tmp log file for test") return file } diff --git a/internal/lambda-managed-instances/testdata/flowtesting.go b/internal/lambda-managed-instances/testdata/flowtesting.go index 28a2013..0380aad 100644 --- a/internal/lambda-managed-instances/testdata/flowtesting.go +++ b/internal/lambda-managed-instances/testdata/flowtesting.go @@ -6,7 +6,7 @@ package testdata import ( "bytes" "context" - "io/ioutil" + "io" "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda-managed-instances/appctx" "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda-managed-instances/core" @@ -29,7 +29,7 @@ type MockInteropServer struct { } func (i *MockInteropServer) SendResponse(invokeID string, resp *interop.StreamableInvokeResponse) (*interop.InvokeResponseMetrics, error) { - bytes, err := ioutil.ReadAll(resp.Payload) + bytes, err := io.ReadAll(resp.Payload) if err != nil { return nil, err } diff --git a/internal/lambda/rie/handlers.go b/internal/lambda/rie/handlers.go index 1abe154..3e4c4a2 100644 --- a/internal/lambda/rie/handlers.go +++ b/internal/lambda/rie/handlers.go @@ -8,7 +8,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "io/ioutil" + "io" "math" "net/http" "os" @@ -76,7 +76,7 @@ func printEndReports(invokeId string, initDuration string, memorySize string, in func InvokeHandler(w http.ResponseWriter, r *http.Request, sandbox Sandbox, bs interop.Bootstrap) { log.Debugf("invoke: -> %s %s %v", r.Method, r.URL, r.Header) - bodyBytes, err := ioutil.ReadAll(r.Body) + bodyBytes, err := io.ReadAll(r.Body) if err != nil { log.Errorf("Failed to read invoke body: %s", err) w.WriteHeader(500) diff --git a/internal/lambda/testdata/flowtesting.go b/internal/lambda/testdata/flowtesting.go index 03280ad..65ce9a2 100644 --- a/internal/lambda/testdata/flowtesting.go +++ b/internal/lambda/testdata/flowtesting.go @@ -6,7 +6,7 @@ package testdata import ( "bytes" "context" - "io/ioutil" + "io" "time" "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda/appctx" @@ -32,7 +32,7 @@ type MockInteropServer struct { // SendResponse writes response to a shared memory. func (i *MockInteropServer) SendResponse(invokeID string, resp *interop.StreamableInvokeResponse) error { - bytes, err := ioutil.ReadAll(resp.Payload) + bytes, err := io.ReadAll(resp.Payload) if err != nil { return err }