Skip to content

Commit

Permalink
refactoring 1
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaka0325 committed Jul 17, 2020
1 parent d5664c8 commit bcdcd95
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kadai1/tanaka0325/imgconv/imgconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ func Run(options Options, args Args) error {
return err
}

// get target image paths from args
udns := args.uniq()
paths, err := getPaths(udns, *options.From)
// get target image flepaths from args
paths, err := getTargetFilePaths(args, *options.From)
if err != nil {
return err
}
Expand All @@ -45,11 +44,12 @@ func Run(options Options, args Args) error {
return nil
}

func getPaths(dns []string, from string) ([]string, error) {
func getTargetFilePaths(args Args, from string) ([]string, error) {
uns := args.uniq()
paths := []string{}

for _, dn := range dns {
if err := filepath.Walk(dn, func(path string, info os.FileInfo, err error) error {
for _, n := range uns {
if err := filepath.Walk(n, func(path string, info os.FileInfo, err error) error {
if filepath.Ext(path) == "."+from {
paths = append(paths, path)
}
Expand Down

0 comments on commit bcdcd95

Please sign in to comment.