Skip to content

Commit

Permalink
Merge pull request #51 from spzala/newtestifelselint
Browse files Browse the repository at this point in the history
Add new test for deepcopy
  • Loading branch information
thockin authored May 31, 2017
2 parents 1914576 + a505af0 commit 5c4c3e9
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/deepcopy-gen/output_tests/emptyinterface/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2017 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:deepcopy-gen=package

// This is a test package.
package emptyinterface

type Ttest struct {
Interface interface{}
}
51 changes: 51 additions & 0 deletions examples/deepcopy-gen/output_tests/emptyinterface/zz_generated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// +build !ignore_autogenerated

/*
Copyright 2017 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.
*/

// This file was autogenerated by deepcopy-gen. Do not edit it manually!

package emptyinterface

import (
conversion "k8s.io/apimachinery/pkg/conversion"
reflect "reflect"
)

// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
return []conversion.GeneratedDeepCopyFunc{
{Fn: DeepCopy_emptyinterface_Ttest, InType: reflect.TypeOf(&Ttest{})},
}
}

// DeepCopy_emptyinterface_Ttest is an autogenerated deepcopy function.
func DeepCopy_emptyinterface_Ttest(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Ttest)
out := out.(*Ttest)
*out = *in
// in.Interface is kind 'Interface'
if in.Interface != nil {
if newVal, err := c.DeepCopy(&in.Interface); err != nil {
return err
} else {
out.Interface = *newVal.(*interface{})
}
}
return nil
}
}
28 changes: 28 additions & 0 deletions examples/deepcopy-gen/output_tests/interfaces/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright 2017 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:deepcopy-gen=package

// This is a test package.
package interfaces

type Inner interface {
function() float64
}

type Ttest struct {
I []Inner
}
54 changes: 54 additions & 0 deletions examples/deepcopy-gen/output_tests/interfaces/zz_generated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// +build !ignore_autogenerated

/*
Copyright 2017 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.
*/

// This file was autogenerated by deepcopy-gen. Do not edit it manually!

package interfaces

import (
conversion "k8s.io/apimachinery/pkg/conversion"
reflect "reflect"
)

// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
return []conversion.GeneratedDeepCopyFunc{
{Fn: DeepCopy_interfaces_Ttest, InType: reflect.TypeOf(&Ttest{})},
}
}

// DeepCopy_interfaces_Ttest is an autogenerated deepcopy function.
func DeepCopy_interfaces_Ttest(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Ttest)
out := out.(*Ttest)
*out = *in
if in.I != nil {
in, out := &in.I, &out.I
*out = make([]Inner, len(*in))
for i := range *in {
if newVal, err := c.DeepCopy(&(*in)[i]); err != nil {
return err
} else {
(*out)[i] = *newVal.(*Inner)
}
}
}
return nil
}
}
24 changes: 24 additions & 0 deletions examples/deepcopy-gen/output_tests/pointer/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2017 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:deepcopy-gen=package

// This is a test package.
package pointer

type Ttest struct {
Types map[string]*Ttest
}
54 changes: 54 additions & 0 deletions examples/deepcopy-gen/output_tests/pointer/zz_generated.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// +build !ignore_autogenerated

/*
Copyright 2017 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.
*/

// This file was autogenerated by deepcopy-gen. Do not edit it manually!

package pointer

import (
conversion "k8s.io/apimachinery/pkg/conversion"
reflect "reflect"
)

// GetGeneratedDeepCopyFuncs returns the generated funcs, since we aren't registering them.
func GetGeneratedDeepCopyFuncs() []conversion.GeneratedDeepCopyFunc {
return []conversion.GeneratedDeepCopyFunc{
{Fn: DeepCopy_pointer_Ttest, InType: reflect.TypeOf(&Ttest{})},
}
}

// DeepCopy_pointer_Ttest is an autogenerated deepcopy function.
func DeepCopy_pointer_Ttest(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Ttest)
out := out.(*Ttest)
*out = *in
if in.Types != nil {
in, out := &in.Types, &out.Types
*out = make(map[string]*Ttest)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
(*out)[key] = *newVal.(**Ttest)
}
}
}
return nil
}
}

0 comments on commit 5c4c3e9

Please # to comment.