github.com/galaxyobe/gen@v0.0.0-20220910125335-392fa8f0990f/cmd/deepcopy-gen/output_tests/wholepkg/a.go (about) 1 /* 2 Copyright 2016 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 package wholepkg 18 19 import "github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg" 20 21 // Trivial 22 type Struct_Empty struct{} 23 24 // Only primitives 25 type Struct_Primitives struct { 26 BoolField bool 27 IntField int 28 StringField string 29 FloatField float64 30 } 31 type Struct_Primitives_Alias Struct_Primitives 32 type Struct_Embed_Struct_Primitives struct { 33 Struct_Primitives 34 } 35 type Struct_Embed_Int struct { 36 int 37 } 38 type Struct_Struct_Primitives struct { 39 StructField Struct_Primitives 40 } 41 42 // Manual DeepCopy method 43 type ManualStruct struct { 44 StringField string 45 } 46 47 func (m ManualStruct) DeepCopy() ManualStruct { 48 return m 49 } 50 51 type ManualStruct_Alias ManualStruct 52 53 type Struct_Embed_ManualStruct struct { 54 ManualStruct 55 } 56 57 // Only pointers to primitives 58 type Struct_PrimitivePointers struct { 59 BoolPtrField *bool 60 IntPtrField *int 61 StringPtrField *string 62 FloatPtrField *float64 63 } 64 type Struct_PrimitivePointers_Alias Struct_PrimitivePointers 65 type Struct_Embed_Struct_PrimitivePointers struct { 66 Struct_PrimitivePointers 67 } 68 type Struct_Embed_Pointer struct { 69 *int 70 } 71 type Struct_Struct_PrimitivePointers struct { 72 StructField Struct_PrimitivePointers 73 } 74 75 // Manual DeepCopy method 76 type ManualSlice []string 77 78 func (m ManualSlice) DeepCopy() ManualSlice { 79 r := make(ManualSlice, len(m)) 80 copy(r, m) 81 return r 82 } 83 84 // Slices 85 type Struct_Slices struct { 86 SliceBoolField []bool 87 SliceByteField []byte 88 SliceIntField []int 89 SliceStringField []string 90 SliceFloatField []float64 91 SliceStructPrimitivesField []Struct_Primitives 92 SliceStructPrimitivesAliasField []Struct_Primitives_Alias 93 SliceStructPrimitivePointersField []Struct_PrimitivePointers 94 SliceStructPrimitivePointersAliasField []Struct_PrimitivePointers_Alias 95 SliceSliceIntField [][]int 96 SliceManualStructField []ManualStruct 97 ManualSliceField ManualSlice 98 } 99 type Struct_Slices_Alias Struct_Slices 100 type Struct_Embed_Struct_Slices struct { 101 Struct_Slices 102 } 103 type Struct_Struct_Slices struct { 104 StructField Struct_Slices 105 } 106 107 // Everything 108 type Struct_Everything struct { 109 BoolField bool 110 IntField int 111 StringField string 112 FloatField float64 113 StructField Struct_Primitives 114 EmptyStructField Struct_Empty 115 ManualStructField ManualStruct 116 ManualStructAliasField ManualStruct_Alias 117 BoolPtrField *bool 118 IntPtrField *int 119 StringPtrField *string 120 FloatPtrField *float64 121 PrimitivePointersField Struct_PrimitivePointers 122 ManualStructPtrField *ManualStruct 123 ManualStructAliasPtrField *ManualStruct_Alias 124 SliceBoolField []bool 125 SliceByteField []byte 126 SliceIntField []int 127 SliceStringField []string 128 SliceFloatField []float64 129 SlicesField Struct_Slices 130 SliceManualStructField []ManualStruct 131 ManualSliceField ManualSlice 132 } 133 134 // An Object 135 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.Object 136 type Struct_ExplicitObject struct { 137 x int 138 } 139 140 // An Object which is used a non-pointer 141 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.Object 142 // +gen:deepcopy:nonpointer-interfaces=true 143 type Struct_NonPointerExplicitObject struct { 144 x int 145 } 146 147 // +gen:deepcopy=false 148 type Struct_TypeMeta struct { 149 } 150 151 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.Object 152 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.List 153 type Struct_ObjectAndList struct { 154 } 155 156 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.Object 157 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.Object 158 type Struct_ObjectAndObject struct { 159 } 160 161 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/wholepkg.Selector 162 // +gen:deepcopy:interfaces=github.com/galaxyobe/gen/cmd/deepcopy-gen/output_tests/otherpkg.Object 163 type Struct_ExplicitSelectorExplicitObject struct { 164 Struct_TypeMeta 165 } 166 167 type Struct_Interfaces struct { 168 ObjectField otherpkg.Object 169 NilObjectField otherpkg.Object 170 SelectorField Selector 171 }