From fc961796ea1aca4fe64e06d776a89d2a37d5db28 Mon Sep 17 00:00:00 2001 From: Tran Hau Date: Wed, 17 Mar 2021 05:13:28 +0000 Subject: [PATCH] feat: deprecated ioutil --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index b9a304e..0e303f5 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "io/ioutil" "log" "os" "path/filepath" @@ -220,7 +219,7 @@ func (a *action) getVersion() (string, error) { func (a *action) generateMarkdownChangelog(output, version string, commits []convention.Commit) error { // If CHANGELOG file already exist var oldData string - bytes, err := ioutil.ReadFile(output) + bytes, err := os.ReadFile(output) if err == nil { oldData = string(bytes) } @@ -228,7 +227,7 @@ func (a *action) generateMarkdownChangelog(output, version string, commits []con markdownGenerator := changelog.NewMarkdownGenerator(oldData, version, time.Now()) newData := markdownGenerator.Generate(commits) - if err := ioutil.WriteFile(output, []byte(newData), 0o644); err != nil { + if err := os.WriteFile(output, []byte(newData), 0o644); err != nil { return fmt.Errorf("failed to write file %s: %w", output, err) }