Skip to content

Commit 1ea0e62

Browse files
committed
deepcopy/testdata: gofmt
1 parent 7f6ed56 commit 1ea0e62

File tree

2 files changed

+63
-52
lines changed

2 files changed

+63
-52
lines changed

pkg/deepcopy/testdata/cronjob_types.go

Lines changed: 57 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -91,58 +91,57 @@ type SpecificCases struct {
9191
BuiltInField string `json:"builtInField"`
9292

9393
// 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"`
9898
BadDeepCopyPtrMismatch `json:"badDeepCopyPtrMismatch"`
9999

100100
// not-quite-deepcopyintos
101-
BadDeepCopyIntoNoParams `json:"badDeepCopyIntoNoParams"`
101+
BadDeepCopyIntoNoParams `json:"badDeepCopyIntoNoParams"`
102102
BadDeepCopyIntoNonPtrParam `json:"badDeepCopyIntoNonPtrParam"`
103-
BadDeepCopyIntoHasResult `json:"badDeepCopyIntoHasResult"`
103+
BadDeepCopyIntoHasResult `json:"badDeepCopyIntoHasResult"`
104104

105105
// compound types in fields
106106

107107
// 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"`
112112
// named types to struct are tested via the reference to this object
113113
// named types to others are tested via the SomePointers/StringMap cases
114114

115115
// 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"`
126126

127127
// 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"`
131131
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"`
135135

136136
// 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"`
140140
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"`
146145

147146
// Regression Tests:
148147

@@ -157,31 +156,36 @@ type SpecificCases struct {
157156
type TotallyAString string
158157

159158
// Tests manual DeepCopy with a pointer receiver
160-
type DeepCopyPtr struct {}
159+
type DeepCopyPtr struct{}
160+
161161
func (d *DeepCopyPtr) DeepCopy() *DeepCopyPtr {
162162
return &DeepCopyPtr{}
163163
}
164164

165165
// Tests manual DeepCopy with a non-pointer receiver
166-
type DeepCopyNonPtr struct {}
166+
type DeepCopyNonPtr struct{}
167+
167168
func (d DeepCopyNonPtr) DeepCopy() DeepCopyNonPtr {
168169
return DeepCopyNonPtr{}
169170
}
170171

171172
// Tests manual DeepCopyInto with a pointer receiver
172-
type DeepCopyIntoPtr struct {}
173+
type DeepCopyIntoPtr struct{}
174+
173175
func (d *DeepCopyIntoPtr) DeepCopyInto(out *DeepCopyIntoPtr) {
174176
*out = DeepCopyIntoPtr{}
175177
}
176178

177179
// Tests manual DeepCopyInto with a non-pointer receiver
178-
type DeepCopyIntoNonPtr struct {}
180+
type DeepCopyIntoNonPtr struct{}
181+
179182
func (d DeepCopyIntoNonPtr) DeepCopyInto(out *DeepCopyIntoNonPtr) {
180183
*out = DeepCopyIntoNonPtr{}
181184
}
182185

183186
// Tests manual DeepCopyInto with a reference type receiver
184187
type DeepCopyIntoRef map[string]string
188+
185189
func (d DeepCopyIntoRef) DeepCopyInto(out *DeepCopyIntoRef) {
186190
*out = make(DeepCopyIntoRef)
187191
}
@@ -200,35 +204,43 @@ type MapOfStrings map[string]string
200204
// tests bad deep copy methods
201205

202206
type BadDeepCopyHasParams struct{}
207+
203208
func (d *BadDeepCopyHasParams) DeepCopy(out string) *BadDeepCopyHasParams {
204209
return nil
205-
}
210+
}
206211

207212
type BadDeepCopyNoReturn struct{}
213+
208214
func (d *BadDeepCopyNoReturn) DeepCopy() {}
209215

210-
type BadDeepCopyPtrVal struct {}
216+
type BadDeepCopyPtrVal struct{}
217+
211218
func (d *BadDeepCopyPtrVal) DeepCopy() *BadDeepCopyNoReturn {
212219
return nil
213220
}
214221

215-
type BadDeepCopyNonPtrVal struct {}
222+
type BadDeepCopyNonPtrVal struct{}
223+
216224
func (d BadDeepCopyNonPtrVal) DeepCopy() BadDeepCopyNoReturn {
217225
return BadDeepCopyNoReturn{}
218226
}
219227

220-
type BadDeepCopyPtrMismatch struct {}
228+
type BadDeepCopyPtrMismatch struct{}
229+
221230
func (d BadDeepCopyPtrMismatch) DeepCopy() *BadDeepCopyPtrMismatch {
222231
return nil
223232
}
224233

225-
type BadDeepCopyIntoNoParams struct {}
234+
type BadDeepCopyIntoNoParams struct{}
235+
226236
func (d BadDeepCopyIntoNoParams) DeepCopyInto() {}
227237

228-
type BadDeepCopyIntoNonPtrParam struct {}
238+
type BadDeepCopyIntoNonPtrParam struct{}
239+
229240
func (d BadDeepCopyIntoNonPtrParam) DeepCopyInto(out BadDeepCopyIntoNonPtrParam) {}
230241

231-
type BadDeepCopyIntoHasResult struct {}
242+
type BadDeepCopyIntoHasResult struct{}
243+
232244
func (d BadDeepCopyIntoHasResult) DeepCopyInto(out *BadDeepCopyIntoHasResult) error {
233245
return nil
234246
}

pkg/deepcopy/testdata/legacy_deepcopy_cases.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type Ttest struct {
6666
}
6767

6868
type TestBuiltins struct {
69-
Byte byte
69+
Byte byte
7070
Int8 int8
7171
Int16 int16
7272
Int32 int32
@@ -81,8 +81,8 @@ type TestBuiltins struct {
8181
}
8282

8383
type TestMaps struct {
84-
Byte map[string]byte
85-
Int8 map[string]int8
84+
Byte map[string]byte
85+
Int8 map[string]int8
8686
Int16 map[string]int16
8787
Int32 map[string]int32
8888
Int64 map[string]int64
@@ -103,7 +103,6 @@ type TestMaps struct {
103103
StructPtr map[string]*Ttest
104104
}
105105

106-
107106
type TestPointers struct {
108107
Builtin *string
109108
Ptr **string
@@ -116,8 +115,8 @@ type TestPointers struct {
116115
}
117116

118117
type TestSlices struct {
119-
Byte []byte
120-
Int8 []int8 //TODO: int8 becomes byte in SnippetWriter
118+
Byte []byte
119+
Int8 []int8 //TODO: int8 becomes byte in SnippetWriter
121120
Int16 []int16
122121
Int32 []int32
123122
Int64 []int64
@@ -139,7 +138,7 @@ type TestSlices struct {
139138
}
140139

141140
type Inner struct {
142-
Byte byte
141+
Byte byte
143142
Int8 int8 //TODO: int8 becomes byte in SnippetWriter
144143
Int16 int16
145144
Int32 int32

0 commit comments

Comments
 (0)