Merge pull request #111566 from inosato/remove-ioutil-from-code-generator

Remove ioutil from code-generator
This commit is contained in:
Kubernetes Prow Robot 2022-08-23 16:05:59 -07:00 committed by GitHub
commit 8887ac620d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,7 @@ package generators
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"strings"
openapiv2 "github.com/google/gnostic/openapiv2"
@ -42,7 +42,7 @@ func newTypeModels(openAPISchemaFilePath string, pkgTypes map[string]*types.Pack
return emptyModels, nil // No Extract<type>() functions will be generated.
}
rawOpenAPISchema, err := ioutil.ReadFile(openAPISchemaFilePath)
rawOpenAPISchema, err := os.ReadFile(openAPISchemaFilePath)
if err != nil {
return nil, fmt.Errorf("failed to read openapi-schema file: %w", err)
}

View File

@ -25,7 +25,6 @@ import (
"go/parser"
"go/printer"
"go/token"
"io/ioutil"
"os"
"reflect"
"strings"
@ -35,7 +34,7 @@ import (
func rewriteFile(name string, header []byte, rewriteFn func(*token.FileSet, *ast.File) error) error {
fset := token.NewFileSet()
src, err := ioutil.ReadFile(name)
src, err := os.ReadFile(name)
if err != nil {
return err
}