Skip to content

Commit 149e820

Browse files
committed
fix: revise based on comment
1 parent 4e42750 commit 149e820

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

kadai1/sh-tatsuno/gophoto/conv/img.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ func (i *Img) Save(path string) error {
3939
ext := filepath.Ext(path)
4040
var err error
4141
err = func(ext string) error {
42-
for _, postfix := range []string{".jpeg", ".jpg", ".gif", ".png"} {
43-
if ext == postfix {
42+
for _, suffix := range []string{".jpeg", ".jpg", ".gif", ".png"} {
43+
if ext == suffix {
4444
return nil
4545
}
4646
}
@@ -79,8 +79,8 @@ func (i *Img) AddExt(ext string) string {
7979
return i.Path + ext
8080
}
8181

82-
// Replace replace image
83-
func (i *Img) Replace(ext string) error {
82+
// Convert convert image
83+
func (i *Img) Convert(ext string) error {
8484

8585
// check path
8686
prevPath := i.Path

kadai1/sh-tatsuno/gophoto/dir/lookup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func Lookup(dir string, ext string, pathList []string) ([]string, error) {
2626
}
2727
}
2828

29-
// check if the postfix is equal to the input format
29+
// check if the suffix is equal to the input format
3030
if filepath.Ext(path) == ext {
3131
pathList = append(pathList, path)
3232
}

kadai1/sh-tatsuno/gophoto/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func run(args []string) int {
4949
var dirName, input, output string
5050

5151
// args
52-
flags := flag.NewFlagSet("imgconv", flag.ContinueOnError)
52+
flags := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
5353
flags.Usage = usage
5454
flags.IntVar(&n, "n", 10, "number of maximum images to convert; default is 10.")
5555
flags.StringVar(&dirName, "d", "", "directory path.")
@@ -84,7 +84,7 @@ func run(args []string) int {
8484
return ExitCodeError
8585
}
8686

87-
if err := img.Replace(output); err != nil {
87+
if err := img.Convert(output); err != nil {
8888
fmt.Printf("can not convert file, %v\n", err)
8989
return ExitCodeError
9090
}

0 commit comments

Comments
 (0)