mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 07:43:29 +03:00
fix: rewrite the healthcheck output selection as a switch
gocritic's ifElseChain check fails make lint on the --json/--quiet branch introduced by b6d47b739; the quality job runs make lint on every push to main. Behavior is unchanged (verified by re-running the json/quiet success and failure cases byte-for-byte). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -285,15 +285,16 @@ func healthcheckMain(ctx *cli.Context) {
|
|||||||
res := probeHealth(baseURL, check, ctx.Bool("maintenance"), timeout)
|
res := probeHealth(baseURL, check, ctx.Bool("maintenance"), timeout)
|
||||||
|
|
||||||
quiet := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
quiet := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
||||||
if ctx.Bool("json") || ctx.GlobalBool("json") {
|
switch {
|
||||||
|
case ctx.Bool("json") || ctx.GlobalBool("json"):
|
||||||
buf, jerr := json.Marshal(res)
|
buf, jerr := json.Marshal(res)
|
||||||
if jerr != nil {
|
if jerr != nil {
|
||||||
fail("%v", jerr)
|
fail("%v", jerr)
|
||||||
}
|
}
|
||||||
fmt.Println(string(buf))
|
fmt.Println(string(buf))
|
||||||
} else if !res.Healthy {
|
case !res.Healthy:
|
||||||
fmt.Fprintln(os.Stderr, res.line())
|
fmt.Fprintln(os.Stderr, res.line())
|
||||||
} else if !quiet {
|
case !quiet:
|
||||||
fmt.Println(res.line())
|
fmt.Println(res.line())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user