summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorYTCai <qazxcv367tasi@gmail.com>2022-11-16 03:18:09 +0800
committerGitHub <noreply@github.com>2022-11-15 14:18:09 -0500
commit1c35fc5b387389051cef132516f8547f7f4e9aaa (patch)
tree668e600e615e172a7688eec2f5b41e1d66648fa1 /cmd
parentccb749f141b100934c550843098c547f21a95fd9 (diff)
fix: update application config sample & replace the deprecated ioutil pkg (#492)
* docs: update application config sample Signed-off-by: CaiYueTing <qazxcv367tasi@gmail.com> * fix: use os read/write instead of deprecated ioutil read/write package Signed-off-by: CaiYueTing <qazxcv367tasi@gmail.com> * fix: use io, os pkg instead of all of the ioutil pkg Signed-off-by: CaiYueTing <qazxcv367tasi@gmail.com> Signed-off-by: CaiYueTing <qazxcv367tasi@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/run.go3
-rw-r--r--cmd/template.go4
2 files changed, 3 insertions, 4 deletions
diff --git a/cmd/run.go b/cmd/run.go
index 581bc4b..305863d 100644
--- a/cmd/run.go
+++ b/cmd/run.go
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
"os"
"strings"
"sync"
@@ -62,7 +61,7 @@ func newRunCommand() *cobra.Command {
// User can specify a path to a template used for Git commit messages
if commitMessagePath != "" {
- tpl, err := ioutil.ReadFile(commitMessagePath)
+ tpl, err := os.ReadFile(commitMessagePath)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
log.Warnf("commit message template at %s does not exist, using default", commitMessagePath)
diff --git a/cmd/template.go b/cmd/template.go
index c73fd30..4c6c925 100644
--- a/cmd/template.go
+++ b/cmd/template.go
@@ -2,7 +2,7 @@ package main
import (
"fmt"
- "io/ioutil"
+ "os"
"text/template"
"time"
@@ -37,7 +37,7 @@ If PATH is not given, will show you the default message that is used.
tplStr = common.DefaultGitCommitMessage
} else {
commitMessageTemplatePath = args[0]
- tplData, err := ioutil.ReadFile(commitMessageTemplatePath)
+ tplData, err := os.ReadFile(commitMessageTemplatePath)
if err != nil {
log.Fatalf("%v", err)
}