Remove ioutil from code-generator

Signed-off-by: inosato <si17_21@yahoo.co.jp>
This commit is contained in:
inosato 2022-07-30 21:03:36 +09:00
parent 3902a53419
commit 6e32805729
2 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,7 @@ package generators
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "os"
"strings" "strings"
openapiv2 "github.com/google/gnostic/openapiv2" 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. return emptyModels, nil // No Extract<type>() functions will be generated.
} }
rawOpenAPISchema, err := ioutil.ReadFile(openAPISchemaFilePath) rawOpenAPISchema, err := os.ReadFile(openAPISchemaFilePath)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to read openapi-schema file: %w", err) return nil, fmt.Errorf("failed to read openapi-schema file: %w", err)
} }

View File

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