| 1 |
/* |
| 2 |
Copyright 2018 The Kubernetes Authors. |
| 3 |
|
| 4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
you may not use this file except in compliance with the License. |
| 6 |
You may obtain a copy of the License at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
See the License for the specific language governing permissions and |
| 14 |
limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
// +k8s:deepcopy-gen=package |
| 18 |
|
| 19 |
// This is a test package. |
| 20 |
package aliases |
| 21 |
|
| 22 |
// Note: the following AliasInterface and AliasAliasInterface +k8s:deepcopy-gen:interfaces tags |
| 23 |
// are necessary because Golang flattens interface alias in the type system. I.e. an alias J of |
| 24 |
// an interface I is actually equivalent to I. So support deepcopies of those aliases, we have |
| 25 |
// to implement all aliases of that interface. |
| 26 |
|
| 27 |
// +k8s:deepcopy-gen:interfaces=k8s.io/gengo/examples/deepcopy-gen/output_tests/aliases.Interface |
| 28 |
// +k8s:deepcopy-gen:interfaces=k8s.io/gengo/examples/deepcopy-gen/output_tests/aliases.AliasInterface |
| 29 |
// +k8s:deepcopy-gen:interfaces=k8s.io/gengo/examples/deepcopy-gen/output_tests/aliases.AliasAliasInterface |
| 30 |
type Foo struct { |
| 31 |
X int |
| 32 |
} |
| 33 |
|
| 34 |
type Interface interface { |
| 35 |
DeepCopyInterface() Interface |
| 36 |
DeepCopyAliasInterface() AliasInterface |
| 37 |
DeepCopyAliasAliasInterface() AliasAliasInterface |
| 38 |
} |
| 39 |
|
| 40 |
type Builtin int |
| 41 |
type Slice []int |
| 42 |
type Pointer *int |
| 43 |
type PointerAlias *Builtin |
| 44 |
type Struct Foo |
| 45 |
type Map map[string]int |
| 46 |
|
| 47 |
type FooAlias Foo |
| 48 |
type FooSlice []Foo |
| 49 |
type FooPointer *Foo |
| 50 |
type FooMap map[string]Foo |
| 51 |
|
| 52 |
type AliasBuiltin Builtin |
| 53 |
type AliasSlice Slice |
| 54 |
type AliasPointer Pointer |
| 55 |
type AliasStruct Struct |
| 56 |
type AliasMap Map |
| 57 |
|
| 58 |
type AliasInterface Interface |
| 59 |
type AliasAliasInterface AliasInterface |
| 60 |
type AliasInterfaceMap map[string]AliasInterface |
| 61 |
type AliasInterfaceSlice []AliasInterface |
| 62 |
|
| 63 |
// Aliases |
| 64 |
type Ttest struct { |
| 65 |
Builtin Builtin |
| 66 |
Slice Slice |
| 67 |
Pointer Pointer |
| 68 |
PointerAlias PointerAlias |
| 69 |
Struct Struct |
| 70 |
Map Map |
| 71 |
SliceSlice []Slice |
| 72 |
MapSlice map[string]Slice |
| 73 |
|
| 74 |
FooAlias FooAlias |
| 75 |
FooSlice FooSlice |
| 76 |
FooPointer FooPointer |
| 77 |
FooMap FooMap |
| 78 |
|
| 79 |
AliasBuiltin AliasBuiltin |
| 80 |
AliasSlice AliasSlice |
| 81 |
AliasPointer AliasPointer |
| 82 |
AliasStruct AliasStruct |
| 83 |
AliasMap AliasMap |
| 84 |
|
| 85 |
AliasInterface AliasInterface |
| 86 |
AliasAliasInterface AliasAliasInterface |
| 87 |
AliasInterfaceMap AliasInterfaceMap |
| 88 |
AliasInterfaceSlice AliasInterfaceSlice |
| 89 |
} |