Skip to content

Commit

Permalink
Revert to fmt.Print for error logging (#777)
Browse files Browse the repository at this point in the history
When an error occurs, it is ultimately brought to the `main.go` file where it is printed for the user (or machine)
Using log.Fatal garbles the error by not rendering newlines

This reverts #774 but adds an os.Exit(1) which is an alternative fix to what the PR did
  • Loading branch information
julienduchesne authored Oct 13, 2022
1 parent f590ad4 commit 2709a0a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/tk/main.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package main

import (
"fmt"
"os"
"strings"

"github.com/go-clix/cli"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"golang.org/x/term"

"github.com/grafana/tanka/pkg/tanka"
Expand Down Expand Up @@ -71,6 +71,7 @@ func main() {

// Run!
if err := rootCmd.Execute(); err != nil {
log.Fatal().Msgf("Error: %s", err)
fmt.Fprintln(os.Stderr, "Error:", err)
os.Exit(1)
}
}

0 comments on commit 2709a0a

Please sign in to comment.