Skip to content

Commit

Permalink
refactor: use Sprintf("%#v") instead of strconv.Quote
Browse files Browse the repository at this point in the history
#471 (comment)

Signed-off-by: Sunghoon Kang <me@hoon.dev>
  • Loading branch information
devholic committed Apr 23, 2024
1 parent 23d5b2f commit 5cb5474
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/generators/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"reflect"
"regexp"
"sort"
"strconv"
"strings"

"k8s.io/gengo/v2"
Expand Down Expand Up @@ -846,9 +845,8 @@ func (g openAPITypeWriter) generateDescription(CommentLines []string) {
}

postDoc := strings.TrimSpace(buffer.String())
postDoc = strconv.Quote(postDoc)
if postDoc != `""` {
g.Do("Description: $.$,\n", postDoc)
if len(postDoc) > 0 {
g.Do("Description: $.$,\n", fmt.Sprintf("%#v", postDoc))
}
}

Expand Down

0 comments on commit 5cb5474

Please sign in to comment.