From 18a0ae5251b81d7f2669599bfefe0e6a17d358d3 Mon Sep 17 00:00:00 2001 From: Gaurav Singh Date: Wed, 22 Apr 2020 00:06:06 -0400 Subject: [PATCH 1/2] [Protobuf] use sort.Strings(...) instead of sort.Sort(sort.StringSlice(...) --- .../code-generator/cmd/go-to-protobuf/protobuf/generator.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go index 1a9803dc88d..930822bdbef 100644 --- a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go +++ b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go @@ -371,7 +371,7 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error { `, b.t) if len(options) > 0 { - sort.Sort(sort.StringSlice(options)) + sort.Strings(options) for _, s := range options { 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)) } - sort.Sort(sort.StringSlice(extras)) + sort.Strings(extras)) if len(extras) > 0 { fmt.Fprintf(out, " [") fmt.Fprint(out, strings.Join(extras, ", ")) From 77c359f7f78ce034f9c1d6e54215bc48b4736af3 Mon Sep 17 00:00:00 2001 From: Gaurav Singh Date: Fri, 24 Apr 2020 08:32:38 -0400 Subject: [PATCH 2/2] Code review changes --- .../code-generator/cmd/go-to-protobuf/protobuf/generator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go index 930822bdbef..025fbc7a4a5 100644 --- a/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go +++ b/staging/src/k8s.io/code-generator/cmd/go-to-protobuf/protobuf/generator.go @@ -399,7 +399,7 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error { } extras = append(extras, fmt.Sprintf("%s = %s", k, v)) } - sort.Strings(extras)) + sort.Strings(extras) if len(extras) > 0 { fmt.Fprintf(out, " [") fmt.Fprint(out, strings.Join(extras, ", "))