From 0087fc81a9f5a27ae9e7ead14a828dc5cee236b2 Mon Sep 17 00:00:00 2001 From: Daniel Milde Date: Thu, 5 Dec 2024 13:57:27 +0100 Subject: [PATCH] feat: print all errors in dev reader --- pkg/env/readers.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/env/readers.go b/pkg/env/readers.go index 0423c5f2..8fa9f510 100644 --- a/pkg/env/readers.go +++ b/pkg/env/readers.go @@ -89,7 +89,15 @@ func devReader(fallback cfg.Reader) cfg.Reader { //nolint:deadcode,unused // Why break } if len(errors) != 0 { - return fallback(fileName) + cfgData, err := fallback(fileName) + if err != nil { + // print all errors + for _, e := range errors { + fmt.Printf("failed to read config file %q: %v\n", fileName, e) + } + return nil, fmt.Errorf("failed to read config file %q: %w", fileName, err) + } + return cfgData, nil } return b, nil