Fix for CLI printing command usage for API Errors with `linkerd viz stat`
Problem: CLI prints command usage for 'linkerd viz stat' in-case of API errors
Solution: Print the error and the exit using `os.Exit(1)` to avoid Cobra printing usage
@@ -203,7 +203,8 @@ If no resource name is specified, displays stats about all resources of the spec
i := 0
for res := range c {
if res.err != nil {
- return res.err
+ fmt.Fprint(os.Stderr, res.err.Error())
+ os.Exit(1)
}
totalRows = append(totalRows, res.rows...)
if i++; i == len(reqs) {
