go-cat2 improve args loop

This commit is contained in:
Meutel 2017-07-07 17:13:07 +02:00
parent 0433c6344c
commit d4ce506f26

View File

@ -43,8 +43,8 @@ func main() {
reader = strings.NewReader(content) reader = strings.NewReader(content)
} else { } else {
readers := []io.Reader{} readers := []io.Reader{}
for i := 1; i < len(os.Args); i++ { for _, fname := range os.Args[1:] {
f := openFile(&os.Args[i]) f := openFile(&fname)
defer f.Close() defer f.Close()
readers = append(readers, f) readers = append(readers, f)
} }