mirror of https://github.com/k3s-io/k3s
Merge pull request #49872 from xiangpengzhao/fix-kubeadm-ver
Automatic merge from submit-queue (batch tested with PRs 49870, 49416, 49872, 49892, 49908) Make "kubeadm version" json format output more readable. **What this PR does / why we need it**: Add indent to json format output. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # ref: #43750 #46598 **Special notes for your reviewer**: output example: ``` #kubeadm version -o json { "clientVersion": { "major": "1", "minor": "8+", "gitVersion": "v1.8.0-alpha.2.1026+d8205661b700c6-dirty", "gitCommit": "d8205661b700c6f99c33ea0ac1e5ed3e49c202b2", "gitTreeState": "dirty", "buildDate": "2017-07-31T12:14:28Z", "goVersion": "go1.8.3", "compiler": "gc", "platform": "linux/amd64" } } ``` **Release note**: ```release-note NONE ```pull/6/head
commit
58e8c3e23d
|
@ -67,7 +67,7 @@ func RunVersion(out io.Writer, cmd *cobra.Command) error {
|
|||
}
|
||||
fmt.Fprintln(out, string(y))
|
||||
case "json":
|
||||
y, err := json.Marshal(&v)
|
||||
y, err := json.MarshalIndent(&v, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue