chore: Replace deprecated io/ioutil functions with recommended alternatives (#9542)

# Which Problems Are Solved

- The `io/ioutil` package was deprecated in Go 1.16.  
  - Reference: https://go.dev/doc/go1.16#ioutil  

# How the Problems Are Solved

- Replaced deprecated functions with their recommended alternatives:  
  - `ioutil.ReadFile` → `os.ReadFile`  
  - `ioutil.ReadAll` → `io.ReadAll`  
  - `ioutil.NopCloser` → `io.NopCloser`
This commit is contained in:
Kenta Yamaguchi
2025-03-17 22:17:14 +09:00
committed by GitHub
parent 19f022e1cf
commit d57fa819cb
6 changed files with 16 additions and 15 deletions

View File

@@ -4,7 +4,8 @@ import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"io"
"os"
"strconv"
"time"
@@ -214,7 +215,7 @@ func (s *Server) transportDataFromFile(ctx context.Context, v1Transformation boo
data = s3Data
}
if localInput != nil {
localData, err := ioutil.ReadFile(localInput.Path)
localData, err := os.ReadFile(localInput.Path)
if err != nil {
return nil, err
}
@@ -274,7 +275,7 @@ func getFileFromS3(ctx context.Context, input *admin_pb.ImportDataRequest_S3Inpu
}
defer object.Close()
return ioutil.ReadAll(object)
return io.ReadAll(object)
}
func getFileFromGCS(ctx context.Context, input *admin_pb.ImportDataRequest_GCSInput) (_ []byte, err error) {
@@ -297,7 +298,7 @@ func getFileFromGCS(ctx context.Context, input *admin_pb.ImportDataRequest_GCSIn
return nil, err
}
defer reader.Close()
return ioutil.ReadAll(reader)
return io.ReadAll(reader)
}
func importOrg1(ctx context.Context, s *Server, errors *[]*admin_pb.ImportDataError, ctxData authz.CtxData, org *admin_pb.DataOrg, success *admin_pb.ImportDataSuccess, count *counts, initCodeGenerator, emailCodeGenerator, phoneCodeGenerator, passwordlessInitCode crypto.Generator) (err error) {