Skip to content

Commit

Permalink
Merge pull request #61523 from dixudx/formatter_escape_percent_sign
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

escape literal percent sign when formatting

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #61503

**Special notes for your reviewer**:
/assign @janetkuo @liggitt 
/cc @kubernetes/sig-cli-bugs 

**Release note**:

```release-note
escape literal percent sign when formatting
```
  • Loading branch information
Kubernetes Submit Queue committed Mar 26, 2018
2 parents 86a5820 + d0dbd94 commit 3a2fe7b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/kubectl/explain/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ func (f *Formatter) Write(str string, a ...interface{}) error {
for i := 0; i < f.IndentLevel; i++ {
indent = indent + " "
}
_, err := io.WriteString(f.Writer, indent+fmt.Sprintf(str, a...)+"\n")

if len(a) > 0 {
str = fmt.Sprintf(str, a...)
}
_, err := io.WriteString(f.Writer, indent+str+"\n")
return err
}

Expand Down

0 comments on commit 3a2fe7b

Please sign in to comment.