Skip to content

Commit 67e1a1e

Browse files
authored
Merge pull request kubernetes#130626 from BenTheElder/sort-client-gen
sort client-gen output
2 parents 07d66d9 + 6f1f7be commit 67e1a1e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

staging/src/k8s.io/code-generator/cmd/client-gen/args/args.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func (args *Args) AddFlags(fs *pflag.FlagSet, inputBase string) {
8585
fs.StringVar(&args.GoHeaderFile, "go-header-file", "",
8686
"the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year")
8787
fs.Var(NewGVPackagesValue(gvsBuilder, nil), "input",
88-
`group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format "group1/version1,group2/version2...". The order in which group/versions are listed defines the order of the generated client code. To avoid non-deterministic output, sort this list before providing it to client-gen.`)
88+
`group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format "group1/version1,group2/version2...".`)
8989
fs.Var(NewGVTypesValue(&args.IncludedTypesOverrides, []string{}), "included-types-overrides",
9090
"list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient will be used for other group versions.")
9191
fs.Var(NewInputBasePathValue(gvsBuilder, inputBase), "input-base",

staging/src/k8s.io/code-generator/cmd/client-gen/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package main
1919

2020
import (
2121
"flag"
22+
"slices"
2223

2324
"github.com/spf13/pflag"
2425
"k8s.io/klog/v2"
@@ -46,6 +47,8 @@ func main() {
4647
inputPkgs = append(inputPkgs, v.Package)
4748
}
4849
}
50+
// ensure stable code generation output
51+
slices.Sort(inputPkgs)
4952

5053
if err := args.Validate(); err != nil {
5154
klog.Fatalf("Error: %v", err)

0 commit comments

Comments
 (0)