From 701e633f5c961bdb3c80c3aca81c3115bb48b088 Mon Sep 17 00:00:00 2001 From: Nuruddin Ashr Date: Tue, 5 Sep 2023 06:27:00 +0700 Subject: [PATCH] Fix multiple path #22 --- cmd/gocognit/main.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/gocognit/main.go b/cmd/gocognit/main.go index 5eaecf8..2814c98 100644 --- a/cmd/gocognit/main.go +++ b/cmd/gocognit/main.go @@ -133,19 +133,18 @@ func analyzePath(path string) ([]gocognit.Stat, error) { return analyzeFile(path, nil) } -func analyze(paths []string) ([]gocognit.Stat, error) { - var ( - stats []gocognit.Stat - err error - ) +func analyze(paths []string) (stats []gocognit.Stat, err error) { + var out []gocognit.Stat for _, path := range paths { - stats, err = analyzePath(path) + stats, err := analyzePath(path) if err != nil { return nil, err } + + out = append(out, stats...) } - return stats, nil + return out, nil } func isDir(filename string) bool {