diff --git a/go-cat2/main.go b/go-cat2/main.go index 863674c..dbed99c 100644 --- a/go-cat2/main.go +++ b/go-cat2/main.go @@ -43,8 +43,8 @@ func main() { reader = strings.NewReader(content) } else { readers := []io.Reader{} - for i := 1; i < len(os.Args); i++ { - f := openFile(&os.Args[i]) + for _, fname := range os.Args[1:] { + f := openFile(&fname) defer f.Close() readers = append(readers, f) }