Bug report
An error prefix is not displayed with error messages. Only the error message is shown.
Cobra handles error messages by default if SilenceErrors is false, but kn handles errors in main.go and sets SilenceErrors to true for the root command.
By removing the SilenceErrors from the root command, there would be no need to print error messages in main.go, and it could be rewrote as follows:
func main() {
defer cleanup()
rand.Seed(time.Now().UnixNano())
kn, err := core.NewDefaultKnCommand()
if err != nil {
os.Exit(1)
}
if err = kn.Execute(); err != nil {
os.Exit(1)
}
}
Then Cobra would properly attach the error prefix to messages by default for all errors.
Expected behavior
An error prefix should be displayed before error messages.
kn service l
Error: unknown sub-command "l" for "kn service"
Steps to reproduce the problem
Produce an error of any kind:
kn service l
unknown sub-command "l" for "kn service"
kn version
What's currently in master as of v0.15.1.
Bug report
An error prefix is not displayed with error messages. Only the error message is shown.
Cobra handles error messages by default if
SilenceErrorsis false, butknhandles errors in main.go and setsSilenceErrorsto true for the root command.By removing the
SilenceErrorsfrom the root command, there would be no need to print error messages in main.go, and it could be rewrote as follows:Then Cobra would properly attach the error prefix to messages by default for all errors.
Expected behavior
An error prefix should be displayed before error messages.
Steps to reproduce the problem
Produce an error of any kind:
kn version
What's currently in master as of v0.15.1.