add prune and remove unused packages

This commit is contained in:
Michelle Au
2019-03-08 14:54:43 -08:00
parent f59b58d164
commit 8c0accad66
17240 changed files with 27 additions and 4750030 deletions

View File

@@ -1 +0,0 @@
defaulter-gen

View File

@@ -1,13 +0,0 @@
{
"Rules": [
{
"SelectorRegexp": "k8s[.]io",
"AllowedPrefixes": [
"k8s.io/gengo",
"k8s.io/klog",
"k8s.io/kubernetes/third_party/forked/golang",
"k8s.io/apimachinery/pkg/runtime"
]
}
]
}

View File

@@ -1,15 +0,0 @@
TOOL=defaulter-gen
test:
@if ! git diff --quiet HEAD; then \
echo "FAIL: git client is not clean"; \
false; \
fi
@go build -o /tmp/$(TOOL)
@PKGS=$$(cd _output_tests; go list ./... | paste -sd' ' -); \
/tmp/$(TOOL) --logtostderr --v=4 -i $$(echo $$PKGS | sed 's/ /,/g') -O zz_generated
@if ! git diff --quiet HEAD; then \
echo "FAIL: output files changed"; \
git diff; \
false; \
fi

View File

@@ -1,2 +0,0 @@
approvers:
- smarterclayton

View File

@@ -1,20 +0,0 @@
/*
Copyright 2018 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.
*/
// +k8s:defaulter-gen=covers
// This is a test package.
package empty // import "k8s.io/gengo/examples/defaulter-gen/_output_tests/empty"

View File

@@ -1,29 +0,0 @@
/*
Copyright 2018 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.
*/
package empty
// Only test
type Ttest struct {
BoolField bool
IntField int
StringField string
FloatField float64
}
type TypeMeta struct {
Fortest bool
}

View File

@@ -1,32 +0,0 @@
// +build !ignore_autogenerated
/*
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 defaulter-gen. DO NOT EDIT.
package empty
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
return nil
}

View File

@@ -1,32 +0,0 @@
/*
Copyright 2018 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.
*/
package pointer
import (
"k8s.io/apimachinery/pkg/runtime"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
func SetDefaults_Tpointer(obj *Tpointer) {
if obj.BoolField == nil {
obj.BoolField = new(bool)
*obj.BoolField = true
}
}

View File

@@ -1,20 +0,0 @@
/*
Copyright 2018 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.
*/
// +k8s:defaulter-gen=TypeMeta
// This is a test package.
package pointer // import "k8s.io/gengo/examples/defaulter-gen/_output_tests/pointer"

View File

@@ -1,33 +0,0 @@
/*
Copyright 2018 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.
*/
package pointer
import (
"k8s.io/gengo/examples/defaulter-gen/_output_tests/empty"
)
type Tpointer struct {
empty.TypeMeta
BoolField *bool
}
// Only test
type Ttest struct {
empty.TypeMeta
NTP Tpointer
Tp *Tpointer
}

View File

@@ -1,45 +0,0 @@
// +build !ignore_autogenerated
/*
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 defaulter-gen. DO NOT EDIT.
package pointer
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&Tpointer{}, func(obj interface{}) { SetObjectDefaults_Tpointer(obj.(*Tpointer)) })
scheme.AddTypeDefaultingFunc(&Ttest{}, func(obj interface{}) { SetObjectDefaults_Ttest(obj.(*Ttest)) })
return nil
}
func SetObjectDefaults_Tpointer(in *Tpointer) {
SetDefaults_Tpointer(in)
}
func SetObjectDefaults_Ttest(in *Ttest) {
SetObjectDefaults_Tpointer(&in.NTP)
if in.Tp != nil {
SetObjectDefaults_Tpointer(in.Tp)
}
}

View File

@@ -1,32 +0,0 @@
/*
Copyright 2018 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.
*/
package slices
import (
"k8s.io/apimachinery/pkg/runtime"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
func SetDefaults_Ttest(obj *Ttest) {
if obj.BoolField == nil {
obj.BoolField = new(bool)
*obj.BoolField = true
}
}

View File

@@ -1,20 +0,0 @@
/*
Copyright 2018 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.
*/
// +k8s:defaulter-gen=TypeMeta
// This is a test package.
package slices // import "k8s.io/gengo/examples/defaulter-gen/_output_tests/slices"

View File

@@ -1,37 +0,0 @@
/*
Copyright 2018 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.
*/
package slices
import (
"k8s.io/gengo/examples/defaulter-gen/_output_tests/empty"
)
// Only test
type Ttest struct {
empty.TypeMeta
BoolField *bool
}
type TtestList struct {
empty.TypeMeta
Items []Ttest
}
type TtestPointerList struct {
empty.TypeMeta
Items []*Ttest
}

View File

@@ -1,55 +0,0 @@
// +build !ignore_autogenerated
/*
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 defaulter-gen. DO NOT EDIT.
package slices
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&Ttest{}, func(obj interface{}) { SetObjectDefaults_Ttest(obj.(*Ttest)) })
scheme.AddTypeDefaultingFunc(&TtestList{}, func(obj interface{}) { SetObjectDefaults_TtestList(obj.(*TtestList)) })
scheme.AddTypeDefaultingFunc(&TtestPointerList{}, func(obj interface{}) { SetObjectDefaults_TtestPointerList(obj.(*TtestPointerList)) })
return nil
}
func SetObjectDefaults_Ttest(in *Ttest) {
SetDefaults_Ttest(in)
}
func SetObjectDefaults_TtestList(in *TtestList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_Ttest(a)
}
}
func SetObjectDefaults_TtestPointerList(in *TtestPointerList) {
for i := range in.Items {
a := in.Items[i]
if a != nil {
SetObjectDefaults_Ttest(a)
}
}
}

View File

@@ -1,32 +0,0 @@
/*
Copyright 2018 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.
*/
package wholepkg
import (
"k8s.io/apimachinery/pkg/runtime"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}
func SetDefaults_Struct_Primitives(obj *Struct_Primitives) {
if obj.BoolField == nil {
obj.BoolField = new(bool)
*obj.BoolField = true
}
}

View File

@@ -1,20 +0,0 @@
/*
Copyright 2018 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.
*/
// +k8s:defaulter-gen=TypeMeta
// This is a test package.
package wholepkg // import "k8s.io/gengo/examples/defaulter-gen/_output_tests/wholepkg"

View File

@@ -1,74 +0,0 @@
/*
Copyright 2018 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.
*/
package wholepkg
import (
"k8s.io/gengo/examples/defaulter-gen/_output_tests/empty"
)
// Only primitives
type Struct_Primitives struct {
empty.TypeMeta
BoolField *bool
IntField *int
StringField *string
FloatField *float64
}
type Struct_Primitives_Alias Struct_Primitives
type Struct_Struct_Primitives struct {
empty.TypeMeta
StructField Struct_Primitives
}
//Pointer
type Struct_Pointer struct {
empty.TypeMeta
PointerStructPrimitivesField Struct_Primitives
PointerPointerStructPrimitivesField *Struct_Primitives
PointerStructPrimitivesAliasField Struct_Primitives_Alias
PointerPointerStructPrimitivesAliasField Struct_Primitives_Alias
PointerStructStructPrimitives Struct_Struct_Primitives
PointerPointerStructStructPrimitives *Struct_Struct_Primitives
}
// Slices
type Struct_Slices struct {
empty.TypeMeta
SliceStructPrimitivesField []Struct_Primitives
SlicePointerStructPrimitivesField []*Struct_Primitives
SliceStructPrimitivesAliasField []Struct_Primitives_Alias
SlicePointerStructPrimitivesAliasField []*Struct_Primitives_Alias
SliceStructStructPrimitives []Struct_Struct_Primitives
SlicePointerStructStructPrimitives []*Struct_Struct_Primitives
}
// Everything
type Struct_Everything struct {
empty.TypeMeta
BoolPtrField *bool
IntPtrField *int
StringPtrField *string
FloatPtrField *float64
PointerStructField Struct_Pointer
SliceBoolField []bool
SliceByteField []byte
SliceIntField []int
SliceStringField []string
SliceFloatField []float64
SlicesStructField Struct_Slices
}

View File

@@ -1,84 +0,0 @@
// +build !ignore_autogenerated
/*
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 defaulter-gen. DO NOT EDIT.
package wholepkg
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&Struct_Everything{}, func(obj interface{}) { SetObjectDefaults_Struct_Everything(obj.(*Struct_Everything)) })
scheme.AddTypeDefaultingFunc(&Struct_Pointer{}, func(obj interface{}) { SetObjectDefaults_Struct_Pointer(obj.(*Struct_Pointer)) })
scheme.AddTypeDefaultingFunc(&Struct_Primitives{}, func(obj interface{}) { SetObjectDefaults_Struct_Primitives(obj.(*Struct_Primitives)) })
scheme.AddTypeDefaultingFunc(&Struct_Slices{}, func(obj interface{}) { SetObjectDefaults_Struct_Slices(obj.(*Struct_Slices)) })
scheme.AddTypeDefaultingFunc(&Struct_Struct_Primitives{}, func(obj interface{}) { SetObjectDefaults_Struct_Struct_Primitives(obj.(*Struct_Struct_Primitives)) })
return nil
}
func SetObjectDefaults_Struct_Everything(in *Struct_Everything) {
SetObjectDefaults_Struct_Pointer(&in.PointerStructField)
SetObjectDefaults_Struct_Slices(&in.SlicesStructField)
}
func SetObjectDefaults_Struct_Pointer(in *Struct_Pointer) {
SetObjectDefaults_Struct_Primitives(&in.PointerStructPrimitivesField)
if in.PointerPointerStructPrimitivesField != nil {
SetObjectDefaults_Struct_Primitives(in.PointerPointerStructPrimitivesField)
}
SetObjectDefaults_Struct_Struct_Primitives(&in.PointerStructStructPrimitives)
if in.PointerPointerStructStructPrimitives != nil {
SetObjectDefaults_Struct_Struct_Primitives(in.PointerPointerStructStructPrimitives)
}
}
func SetObjectDefaults_Struct_Primitives(in *Struct_Primitives) {
SetDefaults_Struct_Primitives(in)
}
func SetObjectDefaults_Struct_Slices(in *Struct_Slices) {
for i := range in.SliceStructPrimitivesField {
a := &in.SliceStructPrimitivesField[i]
SetObjectDefaults_Struct_Primitives(a)
}
for i := range in.SlicePointerStructPrimitivesField {
a := in.SlicePointerStructPrimitivesField[i]
if a != nil {
SetObjectDefaults_Struct_Primitives(a)
}
}
for i := range in.SliceStructStructPrimitives {
a := &in.SliceStructStructPrimitives[i]
SetObjectDefaults_Struct_Struct_Primitives(a)
}
for i := range in.SlicePointerStructStructPrimitives {
a := in.SlicePointerStructStructPrimitives[i]
if a != nil {
SetObjectDefaults_Struct_Struct_Primitives(a)
}
}
}
func SetObjectDefaults_Struct_Struct_Primitives(in *Struct_Struct_Primitives) {
SetObjectDefaults_Struct_Primitives(&in.StructField)
}

View File

@@ -1,75 +0,0 @@
/*
Copyright 2016 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.
*/
// defaulter-gen is a tool for auto-generating Defaulter functions.
//
// Given a list of input directories, it will scan for top level types
// and generate efficient defaulters for an entire object from the sum
// of the SetDefault_* methods contained in the object tree.
//
// Generation is governed by comment tags in the source. Any package may
// request defaulter generation by including one or more comment tags at
// the package comment level:
//
// // +k8s:defaulter-gen=<field-name-to-flag>
//
// which will create defaulters for any type that contains the provided
// field name (if the type has defaulters). Any type may request explicit
// defaulting by providing the comment tag:
//
// // +k8s:defaulter-gen=true|false
//
// An existing defaulter method (`SetDefaults_TYPE`) can provide the
// comment tag:
//
// // +k8s:defaulter-gen=covers
//
// to indicate that the defaulter does not or should not call any nested
// defaulters.
package main
import (
"k8s.io/gengo/args"
"k8s.io/gengo/examples/defaulter-gen/generators"
"github.com/spf13/pflag"
"k8s.io/klog"
)
func main() {
arguments := args.Default()
// Override defaults.
arguments.OutputFileBaseName = "defaulter_generated"
// Custom args.
customArgs := &generators.CustomArgs{
ExtraPeerDirs: []string{},
}
pflag.CommandLine.StringSliceVar(&customArgs.ExtraPeerDirs, "extra-peer-dirs", customArgs.ExtraPeerDirs,
"Comma-separated list of import paths which are considered, after tag-specified peers, for conversions.")
arguments.CustomArgs = customArgs
// Run it.
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
generators.Packages,
); err != nil {
klog.Fatalf("Error: %v", err)
}
klog.V(2).Info("Completed successfully.")
}