Skip to content

Commit

Permalink
chore: switch from io/ioutil to os
Browse files Browse the repository at this point in the history
  • Loading branch information
chuhlomin committed Oct 23, 2022
1 parent 4a66806 commit 08f0793
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"os"
"reflect"
"text/template"
Expand Down Expand Up @@ -39,7 +38,7 @@ func run() error {
}

if c.VarsPath != "" {
varsFile, err := ioutil.ReadFile(c.VarsPath)
varsFile, err := os.ReadFile(c.VarsPath)
if err != nil {
return fmt.Errorf("failed to read vars file %q: %v", c.VarsPath, err)
}
Expand All @@ -60,7 +59,7 @@ func run() error {
}

if len(c.ResultPath) != 0 {
err := ioutil.WriteFile(c.ResultPath, []byte(output), 0644)
err := os.WriteFile(c.ResultPath, []byte(output), 0644)
if err != nil {
return fmt.Errorf("failed to write file %q: %v", c.ResultPath, err)
}
Expand Down Expand Up @@ -93,7 +92,7 @@ func mergeVars(a, b vars) vars {
}

func renderTemplate(templateFilePath string, vars vars) (string, error) {
b, err := ioutil.ReadFile(templateFilePath)
b, err := os.ReadFile(templateFilePath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
return "", fmt.Errorf("template file not found (%q)", templateFilePath)
Expand Down

0 comments on commit 08f0793

Please sign in to comment.