0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-21 22:10:39 +00:00

refactor: change ioutil.ReadFile to os.ReadFile

This commit is contained in:
Beatriz Vieira 2023-01-14 23:56:05 -03:00
parent 5e2ea6bdeb
commit eea20ebf6b
2 changed files with 5 additions and 6 deletions

View File

@ -2,8 +2,8 @@ package main
import ( import (
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os"
"os/exec" "os/exec"
"reflect" "reflect"
"strings" "strings"
@ -53,7 +53,7 @@ func combinedOutputErr(err error, out []byte) error {
} }
func readConfig(filepath string) (Config, error) { func readConfig(filepath string) (Config, error) {
content, rerr := ioutil.ReadFile(filepath) content, rerr := os.ReadFile(filepath)
if rerr != nil { if rerr != nil {
return Config{}, rerr return Config{}, rerr
} }
@ -79,7 +79,7 @@ func defaultConfig() Config {
}, },
Tag: sv.TagConfig{ Tag: sv.TagConfig{
Pattern: "%d.%d.%d", Pattern: "%d.%d.%d",
Filter: "", Filter: "",
}, },
ReleaseNotes: sv.ReleaseNotesConfig{ ReleaseNotes: sv.ReleaseNotesConfig{
Sections: []sv.ReleaseNotesSectionConfig{ Sections: []sv.ReleaseNotesSectionConfig{
@ -101,7 +101,7 @@ func defaultConfig() Config {
Footer: map[string]sv.CommitMessageFooterConfig{ Footer: map[string]sv.CommitMessageFooterConfig{
"issue": {Key: "jira", KeySynonyms: []string{"Jira", "JIRA"}}, "issue": {Key: "jira", KeySynonyms: []string{"Jira", "JIRA"}},
}, },
Issue: sv.CommitMessageIssueConfig{Regex: "[A-Z]+-[0-9]+"}, Issue: sv.CommitMessageIssueConfig{Regex: "[A-Z]+-[0-9]+"},
HeaderSelector: "", HeaderSelector: "",
}, },
} }

View File

@ -3,7 +3,6 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"sort" "sort"
@ -500,7 +499,7 @@ func validateCommitMessageHandler(git sv.Git, messageProcessor sv.MessageProcess
} }
func readFile(filepath string) (string, error) { func readFile(filepath string) (string, error) {
f, err := ioutil.ReadFile(filepath) f, err := os.ReadFile(filepath)
if err != nil { if err != nil {
return "", err return "", err
} }