Skip to content

Commit

Permalink
Don't generate clientset/doc.go in client-gen
Browse files Browse the repository at this point in the history
It seems valuable to be able to provide hand-written docs for these
first-level directories, and if don't want them, the generated doc.go
files are not actually very helpful.

This commit also adds new doc.go files for client-go listers/ and
informers/.

Kubernetes-commit: 95bf7b0afe9dd6a0f00125b1d290514a23e778e2
  • Loading branch information
thockin authored and k8s-publishing-bot committed Jan 12, 2023
1 parent cc14826 commit 8b5f587
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 118 deletions.
26 changes: 8 additions & 18 deletions cmd/client-gen/generators/client_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ func DefaultNameSystem() string {
func packageForGroup(gv clientgentypes.GroupVersion, typeList []*types.Type, clientsetPackage string, groupPackageName string, groupGoName string, apiPath string, srcTreePath string, inputPackage string, applyBuilderPackage string, boilerplate []byte) generator.Package {
groupVersionClientPackage := filepath.Join(clientsetPackage, "typed", strings.ToLower(groupPackageName), strings.ToLower(gv.Version.NonEmpty()))
return &generator.DefaultPackage{
PackageName: strings.ToLower(gv.Version.NonEmpty()),
PackagePath: groupVersionClientPackage,
HeaderText: boilerplate,
PackageDocumentation: []byte(
`// This package has the automatically generated typed clients.
`),
PackageName: strings.ToLower(gv.Version.NonEmpty()),
PackagePath: groupVersionClientPackage,
HeaderText: boilerplate,
PackageDocumentation: []byte("// This package has the automatically generated typed clients.\n"),
// GeneratorFunc returns a list of generators. Each generator makes a
// single file.
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
Expand Down Expand Up @@ -200,16 +198,10 @@ func packageForClientset(customArgs *clientgenargs.CustomArgs, clientsetPackage
PackageName: customArgs.ClientsetName,
PackagePath: clientsetPackage,
HeaderText: boilerplate,
PackageDocumentation: []byte(
`// This package has the automatically generated clientset.
`),
// GeneratorFunc returns a list of generators. Each generator generates a
// single file.
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
generators = []generator.Generator{
// Always generate a "doc.go" file.
generator.DefaultGen{OptionalName: "doc"},

&genClientset{
DefaultGen: generator.DefaultGen{
OptionalName: "clientset",
Expand Down Expand Up @@ -242,12 +234,10 @@ NextGroup:
}

return &generator.DefaultPackage{
PackageName: "scheme",
PackagePath: schemePackage,
HeaderText: boilerplate,
PackageDocumentation: []byte(
`// This package contains the scheme of the automatically generated clientset.
`),
PackageName: "scheme",
PackagePath: schemePackage,
HeaderText: boilerplate,
PackageDocumentation: []byte("// This package contains the scheme of the automatically generated clientset.\n"),
// GeneratorFunc returns a list of generators. Each generator generates a
// single file.
GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) {
Expand Down
20 changes: 0 additions & 20 deletions examples/HyphenGroup/clientset/versioned/doc.go

This file was deleted.

20 changes: 0 additions & 20 deletions examples/MixedCase/clientset/versioned/doc.go

This file was deleted.

20 changes: 0 additions & 20 deletions examples/apiserver/clientset/internalversion/doc.go

This file was deleted.

20 changes: 0 additions & 20 deletions examples/apiserver/clientset/versioned/doc.go

This file was deleted.

20 changes: 0 additions & 20 deletions examples/crd/clientset/versioned/doc.go

This file was deleted.

0 comments on commit 8b5f587

Please sign in to comment.