diff --git a/envplate.go b/envplate.go index 7848600..9395cab 100644 --- a/envplate.go +++ b/envplate.go @@ -1,7 +1,6 @@ package envplate import ( - "io/ioutil" "os" "path/filepath" "regexp" @@ -61,7 +60,7 @@ func (h *Handler) Apply(globs []string) error { func (h *Handler) parse(file string) error { env := envmap.Import() - content, err := ioutil.ReadFile(file) + content, err := os.ReadFile(file) if err != nil { return Log(ERROR, "Cannot open %s: %v", file, err) @@ -138,7 +137,7 @@ func (h *Handler) parse(file string) error { return err } - if err := ioutil.WriteFile(file, []byte(parsed), mode); err != nil { + if err := os.WriteFile(file, []byte(parsed), mode); err != nil { return err } diff --git a/helper_test.go b/helper_test.go index 1403285..058af1d 100644 --- a/helper_test.go +++ b/helper_test.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "log" "os" "testing" @@ -25,7 +24,7 @@ func _exists(name string) bool { func _read(t *testing.T, name string) string { - content, err := ioutil.ReadFile(name) + content, err := os.ReadFile(name) if err != nil { t.Fatal(fmt.Errorf("error while reading '%s': %v", name, err)) @@ -82,7 +81,7 @@ func _restore(file string) { func _tmpdir(t *testing.T, f func(string)) { - dir, err := ioutil.TempDir("", "") + dir, err := os.MkdirTemp("", "") if err != nil { t.Fatal(err) @@ -96,7 +95,7 @@ func _tmpdir(t *testing.T, f func(string)) { func _write(t *testing.T, name, content string, mode os.FileMode) string { - file, err := ioutil.TempFile("", name) + file, err := os.CreateTemp("", name) if err != nil { t.Fatalf("Error while opening '%s': %v", name, err)