@@ -91,58 +91,57 @@ type SpecificCases struct {
91
91
BuiltInField string `json:"builtInField"`
92
92
93
93
// non-quite deepcopies
94
- BadDeepCopyHasParams `json:"badDeepCopyHasParams"`
95
- BadDeepCopyNoReturn `json:"badDeepCopyNoReturn"`
96
- BadDeepCopyPtrVal `json:"badDeepCopyPtrVal"`
97
- BadDeepCopyNonPtrVal `json:"badDeepCopyNonPtrVal"`
94
+ BadDeepCopyHasParams `json:"badDeepCopyHasParams"`
95
+ BadDeepCopyNoReturn `json:"badDeepCopyNoReturn"`
96
+ BadDeepCopyPtrVal `json:"badDeepCopyPtrVal"`
97
+ BadDeepCopyNonPtrVal `json:"badDeepCopyNonPtrVal"`
98
98
BadDeepCopyPtrMismatch `json:"badDeepCopyPtrMismatch"`
99
99
100
100
// not-quite-deepcopyintos
101
- BadDeepCopyIntoNoParams `json:"badDeepCopyIntoNoParams"`
101
+ BadDeepCopyIntoNoParams `json:"badDeepCopyIntoNoParams"`
102
102
BadDeepCopyIntoNonPtrParam `json:"badDeepCopyIntoNonPtrParam"`
103
- BadDeepCopyIntoHasResult `json:"badDeepCopyIntoHasResult"`
103
+ BadDeepCopyIntoHasResult `json:"badDeepCopyIntoHasResult"`
104
104
105
105
// compound types in fields
106
106
107
107
// also tests maps/slices/etc of built-in types
108
- MapInField map [string ]string `json:"mapInField"`
109
- SliceInField []string `json:"sliceInField"`
110
- BuiltInPointer * string `json:"pointerInField"`
111
- NamedTypeInField TotallyAString `json:"namedTypeInField"`
108
+ MapInField map [string ]string `json:"mapInField"`
109
+ SliceInField []string `json:"sliceInField"`
110
+ BuiltInPointer * string `json:"pointerInField"`
111
+ NamedTypeInField TotallyAString `json:"namedTypeInField"`
112
112
// named types to struct are tested via the reference to this object
113
113
// named types to others are tested via the SomePointers/StringMap cases
114
114
115
115
// other map types
116
- MapToDeepCopyPtr map [string ]DeepCopyPtr `json:"mapToDeepCopyPtr"`
117
- MapToDeepCopyNonPtr map [string ]DeepCopyPtr `json:"mapToDeepCopyNonPtr"`
118
- MapToDeepCopyIntoPtr map [string ]DeepCopyIntoPtr `json:"mapToDeepCopyIntoPtr"`
119
- MapToDeepCopyIntoNonPtr map [string ]DeepCopyIntoNonPtr `json:"mapToDeepCopyIntoNonPtr"`
120
- MapToShallowNamedType map [string ]TotallyAString `json:"mapToShallowNamedType"`
121
- MapToReferenceType map [string ][]string `json:"mapToReferenceType"`
122
- MapToStruct map [string ]CronJobSpec `json:"mapToStruct"`
123
- MapWithNamedKeys map [TotallyAString ]int `json:"mapWithNamedKeys"`
124
- MapToPtrToDeepCopyIntoRefType map [string ]* DeepCopyIntoRef `json:"mapToPtrToDeepCopyIntoRefType"`
125
- MapToDeepCopyIntoRefType map [string ]DeepCopyIntoRef `json:"mapToDeepCopyIntoRefType"`
116
+ MapToDeepCopyPtr map [string ]DeepCopyPtr `json:"mapToDeepCopyPtr"`
117
+ MapToDeepCopyNonPtr map [string ]DeepCopyPtr `json:"mapToDeepCopyNonPtr"`
118
+ MapToDeepCopyIntoPtr map [string ]DeepCopyIntoPtr `json:"mapToDeepCopyIntoPtr"`
119
+ MapToDeepCopyIntoNonPtr map [string ]DeepCopyIntoNonPtr `json:"mapToDeepCopyIntoNonPtr"`
120
+ MapToShallowNamedType map [string ]TotallyAString `json:"mapToShallowNamedType"`
121
+ MapToReferenceType map [string ][]string `json:"mapToReferenceType"`
122
+ MapToStruct map [string ]CronJobSpec `json:"mapToStruct"`
123
+ MapWithNamedKeys map [TotallyAString ]int `json:"mapWithNamedKeys"`
124
+ MapToPtrToDeepCopyIntoRefType map [string ]* DeepCopyIntoRef `json:"mapToPtrToDeepCopyIntoRefType"`
125
+ MapToDeepCopyIntoRefType map [string ]DeepCopyIntoRef `json:"mapToDeepCopyIntoRefType"`
126
126
127
127
// other slice types
128
- SliceToDeepCopyPtr []DeepCopyPtr `json:"sliceToDeepCopyPtr"`
129
- SliceToDeepCopyNonPtr []DeepCopyPtr `json:"sliceToDeepCopyNonPtr"`
130
- SliceToDeepCopyIntoPtr []DeepCopyIntoPtr `json:"sliceToDeepCopyIntoPtr"`
128
+ SliceToDeepCopyPtr []DeepCopyPtr `json:"sliceToDeepCopyPtr"`
129
+ SliceToDeepCopyNonPtr []DeepCopyPtr `json:"sliceToDeepCopyNonPtr"`
130
+ SliceToDeepCopyIntoPtr []DeepCopyIntoPtr `json:"sliceToDeepCopyIntoPtr"`
131
131
SliceToDeepCopyIntoNonPtr []DeepCopyIntoNonPtr `json:"sliceToDeepCopyIntoNonPtr"`
132
- SliceToShallowNamedType []TotallyAString `json:"sliceToShallowNamedType"`
133
- SliceToReferenceType [][]string `json:"sliceToReferenceType"`
134
- SliceToStruct []CronJobSpec `json:"sliceToStruct"`
132
+ SliceToShallowNamedType []TotallyAString `json:"sliceToShallowNamedType"`
133
+ SliceToReferenceType [][]string `json:"sliceToReferenceType"`
134
+ SliceToStruct []CronJobSpec `json:"sliceToStruct"`
135
135
136
136
// other pointer types
137
- PtrToDeepCopyPtr * DeepCopyPtr `json:"ptrToDeepCopyPtr"`
138
- PtrToDeepCopyNonPtr * DeepCopyPtr `json:"ptrToDeepCopyNonPtr"`
139
- PtrToDeepCopyIntoPtr * DeepCopyIntoPtr `json:"ptrToDeepCopyIntoPtr"`
137
+ PtrToDeepCopyPtr * DeepCopyPtr `json:"ptrToDeepCopyPtr"`
138
+ PtrToDeepCopyNonPtr * DeepCopyPtr `json:"ptrToDeepCopyNonPtr"`
139
+ PtrToDeepCopyIntoPtr * DeepCopyIntoPtr `json:"ptrToDeepCopyIntoPtr"`
140
140
PtrToDeepCopyIntoNonPtr * DeepCopyIntoNonPtr `json:"ptrToDeepCopyIntoNonPtr"`
141
- PtrToShallowNamedType * TotallyAString `json:"ptrToShallowNamedType"`
142
- PtrToReferenceType * []string `json:"ptrToReferenceType"`
143
- PtrToStruct * CronJobSpec `json:"ptrToStruct"`
144
- PtrToDeepCopyIntoRef * DeepCopyIntoRef `json:"ptrToDeepCopyIntoRef"`
145
-
141
+ PtrToShallowNamedType * TotallyAString `json:"ptrToShallowNamedType"`
142
+ PtrToReferenceType * []string `json:"ptrToReferenceType"`
143
+ PtrToStruct * CronJobSpec `json:"ptrToStruct"`
144
+ PtrToDeepCopyIntoRef * DeepCopyIntoRef `json:"ptrToDeepCopyIntoRef"`
146
145
147
146
// Regression Tests:
148
147
@@ -157,31 +156,36 @@ type SpecificCases struct {
157
156
type TotallyAString string
158
157
159
158
// Tests manual DeepCopy with a pointer receiver
160
- type DeepCopyPtr struct {}
159
+ type DeepCopyPtr struct {}
160
+
161
161
func (d * DeepCopyPtr ) DeepCopy () * DeepCopyPtr {
162
162
return & DeepCopyPtr {}
163
163
}
164
164
165
165
// Tests manual DeepCopy with a non-pointer receiver
166
- type DeepCopyNonPtr struct {}
166
+ type DeepCopyNonPtr struct {}
167
+
167
168
func (d DeepCopyNonPtr ) DeepCopy () DeepCopyNonPtr {
168
169
return DeepCopyNonPtr {}
169
170
}
170
171
171
172
// Tests manual DeepCopyInto with a pointer receiver
172
- type DeepCopyIntoPtr struct {}
173
+ type DeepCopyIntoPtr struct {}
174
+
173
175
func (d * DeepCopyIntoPtr ) DeepCopyInto (out * DeepCopyIntoPtr ) {
174
176
* out = DeepCopyIntoPtr {}
175
177
}
176
178
177
179
// Tests manual DeepCopyInto with a non-pointer receiver
178
- type DeepCopyIntoNonPtr struct {}
180
+ type DeepCopyIntoNonPtr struct {}
181
+
179
182
func (d DeepCopyIntoNonPtr ) DeepCopyInto (out * DeepCopyIntoNonPtr ) {
180
183
* out = DeepCopyIntoNonPtr {}
181
184
}
182
185
183
186
// Tests manual DeepCopyInto with a reference type receiver
184
187
type DeepCopyIntoRef map [string ]string
188
+
185
189
func (d DeepCopyIntoRef ) DeepCopyInto (out * DeepCopyIntoRef ) {
186
190
* out = make (DeepCopyIntoRef )
187
191
}
@@ -200,35 +204,43 @@ type MapOfStrings map[string]string
200
204
// tests bad deep copy methods
201
205
202
206
type BadDeepCopyHasParams struct {}
207
+
203
208
func (d * BadDeepCopyHasParams ) DeepCopy (out string ) * BadDeepCopyHasParams {
204
209
return nil
205
- }
210
+ }
206
211
207
212
type BadDeepCopyNoReturn struct {}
213
+
208
214
func (d * BadDeepCopyNoReturn ) DeepCopy () {}
209
215
210
- type BadDeepCopyPtrVal struct {}
216
+ type BadDeepCopyPtrVal struct {}
217
+
211
218
func (d * BadDeepCopyPtrVal ) DeepCopy () * BadDeepCopyNoReturn {
212
219
return nil
213
220
}
214
221
215
- type BadDeepCopyNonPtrVal struct {}
222
+ type BadDeepCopyNonPtrVal struct {}
223
+
216
224
func (d BadDeepCopyNonPtrVal ) DeepCopy () BadDeepCopyNoReturn {
217
225
return BadDeepCopyNoReturn {}
218
226
}
219
227
220
- type BadDeepCopyPtrMismatch struct {}
228
+ type BadDeepCopyPtrMismatch struct {}
229
+
221
230
func (d BadDeepCopyPtrMismatch ) DeepCopy () * BadDeepCopyPtrMismatch {
222
231
return nil
223
232
}
224
233
225
- type BadDeepCopyIntoNoParams struct {}
234
+ type BadDeepCopyIntoNoParams struct {}
235
+
226
236
func (d BadDeepCopyIntoNoParams ) DeepCopyInto () {}
227
237
228
- type BadDeepCopyIntoNonPtrParam struct {}
238
+ type BadDeepCopyIntoNonPtrParam struct {}
239
+
229
240
func (d BadDeepCopyIntoNonPtrParam ) DeepCopyInto (out BadDeepCopyIntoNonPtrParam ) {}
230
241
231
- type BadDeepCopyIntoHasResult struct {}
242
+ type BadDeepCopyIntoHasResult struct {}
243
+
232
244
func (d BadDeepCopyIntoHasResult ) DeepCopyInto (out * BadDeepCopyIntoHasResult ) error {
233
245
return nil
234
246
}
0 commit comments