Merge pull request #90353 from gaurav1086/protofuf_use_sort_Strings

[Protobuf] simplify sort expression
This commit is contained in:
Kubernetes Prow Robot 2020-04-24 15:31:58 -07:00 committed by GitHub
commit 5555cc1cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,7 +371,7 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error {
`, b.t) `, b.t)
if len(options) > 0 { if len(options) > 0 {
sort.Sort(sort.StringSlice(options)) sort.Strings(options)
for _, s := range options { for _, s := range options {
fmt.Fprintf(out, " option %s;\n", s) fmt.Fprintf(out, " option %s;\n", s)
} }
@ -399,7 +399,7 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error {
} }
extras = append(extras, fmt.Sprintf("%s = %s", k, v)) extras = append(extras, fmt.Sprintf("%s = %s", k, v))
} }
sort.Sort(sort.StringSlice(extras)) sort.Strings(extras)
if len(extras) > 0 { if len(extras) > 0 {
fmt.Fprintf(out, " [") fmt.Fprintf(out, " [")
fmt.Fprint(out, strings.Join(extras, ", ")) fmt.Fprint(out, strings.Join(extras, ", "))