From d4ce506f26029f7ba1eba892755cf230917f1160 Mon Sep 17 00:00:00 2001 From: Meutel Date: Fri, 7 Jul 2017 17:13:07 +0200 Subject: [PATCH] go-cat2 improve args loop --- go-cat2/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) }