mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Remove ioutil from code-generator
Signed-off-by: inosato <si17_21@yahoo.co.jp>
This commit is contained in:
parent
3902a53419
commit
6e32805729
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user