mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-29 09:40:49 +00:00
Stop using deprecated ioutil functions
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -122,7 +121,7 @@ func AddGenerateDockerfile(cmd *cobra.Command) {
|
||||
Use: "gen [DIR]",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := ioutil.WriteFile(filepath.Join(args[0], "Dockerfile"), []byte(`FROM golang:1.18-alpine as builder
|
||||
if err := os.WriteFile(filepath.Join(args[0], "Dockerfile"), []byte(`FROM golang:1.18-alpine as builder
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
COPY go.mod go.sum ./
|
||||
@@ -143,7 +142,7 @@ ENTRYPOINT ["function"]
|
||||
}
|
||||
|
||||
func functionConfigFromFile(file string) (*yaml.RNode, error) {
|
||||
b, err := ioutil.ReadFile(file)
|
||||
b, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return nil, errors.WrapPrefixf(err, "unable to read configuration file %q", file)
|
||||
}
|
||||
@@ -161,7 +160,7 @@ type deferredFileReader struct {
|
||||
|
||||
func (fr *deferredFileReader) Read(dest []byte) (int, error) {
|
||||
if fr.srcReader == nil {
|
||||
src, err := ioutil.ReadFile(fr.path)
|
||||
src, err := os.ReadFile(fr.path)
|
||||
if err != nil {
|
||||
return 0, errors.WrapPrefixf(err, "unable to read input file %s", fr.path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user