From 6dc8251189a375a375e5f7e6352c5aa4d107c488 Mon Sep 17 00:00:00 2001 From: Sajad Parra Date: Thu, 9 Sep 2021 17:19:57 +0530 Subject: [PATCH] change switch case order to check for input file first --- internal/runner/runner.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 73f6765..b8162f9 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -79,18 +79,17 @@ func (r *Runner) Run() error { var err error switch { + case r.options.Data != "": + inFile, err = os.Open(r.options.Data) + if err != nil { + gologger.Fatal().Msgf("%s\n", err) + } case hasStdin(): if r.options.Bulk { gologger.Error().Msgf("bulk flag is not supported with stdin") os.Exit(1) } inFile = os.Stdin - - case r.options.Data != "": - inFile, err = os.Open(r.options.Data) - if err != nil { - gologger.Fatal().Msgf("%s\n", err) - } default: return errors.New("notify works with stdin or file using -data flag") }