From eea20ebf6b6b77c9183b7387936a1fcf1669a06d Mon Sep 17 00:00:00 2001 From: Beatriz Vieira Date: Sat, 14 Jan 2023 23:56:05 -0300 Subject: [PATCH] refactor: change ioutil.ReadFile to os.ReadFile --- cmd/git-sv/config.go | 8 ++++---- cmd/git-sv/handlers.go | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/git-sv/config.go b/cmd/git-sv/config.go index 04fc14b..ceb9458 100644 --- a/cmd/git-sv/config.go +++ b/cmd/git-sv/config.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "io/ioutil" "log" + "os" "os/exec" "reflect" "strings" @@ -53,7 +53,7 @@ func combinedOutputErr(err error, out []byte) error { } func readConfig(filepath string) (Config, error) { - content, rerr := ioutil.ReadFile(filepath) + content, rerr := os.ReadFile(filepath) if rerr != nil { return Config{}, rerr } @@ -79,7 +79,7 @@ func defaultConfig() Config { }, Tag: sv.TagConfig{ Pattern: "%d.%d.%d", - Filter: "", + Filter: "", }, ReleaseNotes: sv.ReleaseNotesConfig{ Sections: []sv.ReleaseNotesSectionConfig{ @@ -101,7 +101,7 @@ func defaultConfig() Config { Footer: map[string]sv.CommitMessageFooterConfig{ "issue": {Key: "jira", KeySynonyms: []string{"Jira", "JIRA"}}, }, - Issue: sv.CommitMessageIssueConfig{Regex: "[A-Z]+-[0-9]+"}, + Issue: sv.CommitMessageIssueConfig{Regex: "[A-Z]+-[0-9]+"}, HeaderSelector: "", }, } diff --git a/cmd/git-sv/handlers.go b/cmd/git-sv/handlers.go index 5451af7..9f99266 100644 --- a/cmd/git-sv/handlers.go +++ b/cmd/git-sv/handlers.go @@ -3,7 +3,6 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "sort" @@ -500,7 +499,7 @@ func validateCommitMessageHandler(git sv.Git, messageProcessor sv.MessageProcess } func readFile(filepath string) (string, error) { - f, err := ioutil.ReadFile(filepath) + f, err := os.ReadFile(filepath) if err != nil { return "", err }