diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2020-09-29 20:07:46 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2020-09-29 20:07:46 -0400 |
| commit | 7c93217f5c6b2eb8830ddc1d6ed395f567832af6 (patch) | |
| tree | 387df1e05f9fc189fc4bd9ec0bf6f39765845190 /cmd | |
| parent | c75fa4aaaad4a9679b09cbfcb35c527d9a471d3b (diff) | |
Lint fixes
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/gomplate/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/gomplate/main.go b/cmd/gomplate/main.go index ab52c630..730ac8eb 100644 --- a/cmd/gomplate/main.go +++ b/cmd/gomplate/main.go @@ -150,6 +150,11 @@ func initFlags(command *cobra.Command) { } func main() { + exitCode := 0 + // defer the exit first to make sure that other deferred functions have a + // chance to run + defer func() { os.Exit(exitCode) }() + ctx, cancel := context.WithCancel(context.Background()) defer cancel() ctx = initLogger(ctx) @@ -158,6 +163,7 @@ func main() { initFlags(command) if err := command.ExecuteContext(ctx); err != nil { log := zerolog.Ctx(ctx) - log.Fatal().Err(err).Send() + log.Error().Err(err).Send() + exitCode = 1 } } |
