From 95bf7b0afe9dd6a0f00125b1d290514a23e778e2 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Thu, 12 Jan 2023 09:51:33 -0800 Subject: [PATCH] Don't generate clientset/doc.go in client-gen 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/. --- .../pkg/client/clientset/deprecated/doc.go | 20 -------------- .../versioned => client-go/informers}/doc.go | 8 +++--- .../src/k8s.io/client-go/kubernetes/doc.go | 7 +++-- .../clientset => client-go/listers}/doc.go | 8 +++--- .../client-gen/generators/client_generator.go | 26 ++++++------------- .../HyphenGroup/clientset/versioned/doc.go | 20 -------------- .../MixedCase/clientset/versioned/doc.go | 20 -------------- .../clientset/internalversion/doc.go | 20 -------------- .../apiserver/clientset/versioned/doc.go | 20 -------------- .../examples/crd/clientset/versioned/doc.go | 20 -------------- .../clientset_generated/clientset/doc.go | 20 -------------- .../clientset_generated/deprecated/doc.go | 20 -------------- .../pkg/client/clientset/deprecated/doc.go | 20 -------------- .../pkg/client/clientset/versioned/doc.go | 20 -------------- .../pkg/generated/clientset/versioned/doc.go | 20 -------------- .../pkg/generated/clientset/versioned/doc.go | 20 -------------- 16 files changed, 17 insertions(+), 272 deletions(-) delete mode 100644 staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/deprecated/doc.go rename staging/src/k8s.io/{apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned => client-go/informers}/doc.go (77%) rename staging/src/k8s.io/{apiextensions-apiserver/pkg/client/clientset/clientset => client-go/listers}/doc.go (77%) delete mode 100644 staging/src/k8s.io/code-generator/examples/HyphenGroup/clientset/versioned/doc.go delete mode 100644 staging/src/k8s.io/code-generator/examples/MixedCase/clientset/versioned/doc.go delete mode 100644 staging/src/k8s.io/code-generator/examples/apiserver/clientset/internalversion/doc.go delete mode 100644 staging/src/k8s.io/code-generator/examples/apiserver/clientset/versioned/doc.go delete mode 100644 staging/src/k8s.io/code-generator/examples/crd/clientset/versioned/doc.go delete mode 100644 staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/doc.go delete mode 100644 staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/deprecated/doc.go delete mode 100644 staging/src/k8s.io/metrics/pkg/client/clientset/deprecated/doc.go delete mode 100644 staging/src/k8s.io/metrics/pkg/client/clientset/versioned/doc.go delete mode 100644 staging/src/k8s.io/sample-apiserver/pkg/generated/clientset/versioned/doc.go delete mode 100644 staging/src/k8s.io/sample-controller/pkg/generated/clientset/versioned/doc.go diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/deprecated/doc.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/deprecated/doc.go deleted file mode 100644 index 87b5bf0419e..00000000000 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/deprecated/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package deprecated diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/doc.go b/staging/src/k8s.io/client-go/informers/doc.go similarity index 77% rename from staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/doc.go rename to staging/src/k8s.io/client-go/informers/doc.go index 41721ca52d4..231bffb69bd 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/pkg/client/clientset/versioned/doc.go +++ b/staging/src/k8s.io/client-go/informers/doc.go @@ -1,5 +1,5 @@ /* -Copyright The Kubernetes Authors. +Copyright 2023 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned +// Package informers provides generated informers for Kubernetes APIs. +package informers diff --git a/staging/src/k8s.io/client-go/kubernetes/doc.go b/staging/src/k8s.io/client-go/kubernetes/doc.go index b272334ad0e..9cef4242f2f 100644 --- a/staging/src/k8s.io/client-go/kubernetes/doc.go +++ b/staging/src/k8s.io/client-go/kubernetes/doc.go @@ -1,5 +1,5 @@ /* -Copyright The Kubernetes Authors. +Copyright 2023 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. +// Package kubernetes holds packages which implement a clientset for Kubernetes +// APIs. package kubernetes diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/doc.go b/staging/src/k8s.io/client-go/listers/doc.go similarity index 77% rename from staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/doc.go rename to staging/src/k8s.io/client-go/listers/doc.go index ee865e56d1d..da6a80408fd 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/doc.go +++ b/staging/src/k8s.io/client-go/listers/doc.go @@ -1,5 +1,5 @@ /* -Copyright The Kubernetes Authors. +Copyright 2023 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,7 +14,5 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package clientset +// Package listers provides generated listers for Kubernetes APIs. +package listers diff --git a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go index 6739a3fa46d..ef4466d8005 100644 --- a/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go +++ b/staging/src/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go @@ -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) { @@ -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", @@ -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) { diff --git a/staging/src/k8s.io/code-generator/examples/HyphenGroup/clientset/versioned/doc.go b/staging/src/k8s.io/code-generator/examples/HyphenGroup/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/code-generator/examples/HyphenGroup/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/staging/src/k8s.io/code-generator/examples/MixedCase/clientset/versioned/doc.go b/staging/src/k8s.io/code-generator/examples/MixedCase/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/code-generator/examples/MixedCase/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/clientset/internalversion/doc.go b/staging/src/k8s.io/code-generator/examples/apiserver/clientset/internalversion/doc.go deleted file mode 100644 index 6c970b092aa..00000000000 --- a/staging/src/k8s.io/code-generator/examples/apiserver/clientset/internalversion/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package internalversion diff --git a/staging/src/k8s.io/code-generator/examples/apiserver/clientset/versioned/doc.go b/staging/src/k8s.io/code-generator/examples/apiserver/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/code-generator/examples/apiserver/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/staging/src/k8s.io/code-generator/examples/crd/clientset/versioned/doc.go b/staging/src/k8s.io/code-generator/examples/crd/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/code-generator/examples/crd/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/doc.go b/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/doc.go deleted file mode 100644 index ee865e56d1d..00000000000 --- a/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package clientset diff --git a/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/deprecated/doc.go b/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/deprecated/doc.go deleted file mode 100644 index 87b5bf0419e..00000000000 --- a/staging/src/k8s.io/kube-aggregator/pkg/client/clientset_generated/deprecated/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package deprecated diff --git a/staging/src/k8s.io/metrics/pkg/client/clientset/deprecated/doc.go b/staging/src/k8s.io/metrics/pkg/client/clientset/deprecated/doc.go deleted file mode 100644 index 87b5bf0419e..00000000000 --- a/staging/src/k8s.io/metrics/pkg/client/clientset/deprecated/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package deprecated diff --git a/staging/src/k8s.io/metrics/pkg/client/clientset/versioned/doc.go b/staging/src/k8s.io/metrics/pkg/client/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/metrics/pkg/client/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/staging/src/k8s.io/sample-apiserver/pkg/generated/clientset/versioned/doc.go b/staging/src/k8s.io/sample-apiserver/pkg/generated/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/sample-apiserver/pkg/generated/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/staging/src/k8s.io/sample-controller/pkg/generated/clientset/versioned/doc.go b/staging/src/k8s.io/sample-controller/pkg/generated/clientset/versioned/doc.go deleted file mode 100644 index 41721ca52d4..00000000000 --- a/staging/src/k8s.io/sample-controller/pkg/generated/clientset/versioned/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned