feat: deprecated ioutil
parent
616b403203
commit
fc961796ea
5
main.go
5
main.go
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -220,7 +219,7 @@ func (a *action) getVersion() (string, error) {
|
||||||
func (a *action) generateMarkdownChangelog(output, version string, commits []convention.Commit) error {
|
func (a *action) generateMarkdownChangelog(output, version string, commits []convention.Commit) error {
|
||||||
// If CHANGELOG file already exist
|
// If CHANGELOG file already exist
|
||||||
var oldData string
|
var oldData string
|
||||||
bytes, err := ioutil.ReadFile(output)
|
bytes, err := os.ReadFile(output)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
oldData = string(bytes)
|
oldData = string(bytes)
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,7 @@ func (a *action) generateMarkdownChangelog(output, version string, commits []con
|
||||||
markdownGenerator := changelog.NewMarkdownGenerator(oldData, version, time.Now())
|
markdownGenerator := changelog.NewMarkdownGenerator(oldData, version, time.Now())
|
||||||
newData := markdownGenerator.Generate(commits)
|
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)
|
return fmt.Errorf("failed to write file %s: %w", output, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue