@@ -74,7 +74,6 @@ type Event struct {
74
74
// String returns a string suitable for logging
75
75
func (e Event ) String () string {
76
76
var sb strings.Builder
77
- sb .WriteString ("Event{ " )
78
77
switch e .Type {
79
78
case InitType :
80
79
sb .WriteString (e .InitEvent .String ())
@@ -95,7 +94,6 @@ func (e Event) String() string {
95
94
case ValidationType :
96
95
sb .WriteString (e .ValidationEvent .String ())
97
96
}
98
- sb .WriteString (" }" )
99
97
return sb .String ()
100
98
}
101
99
@@ -221,8 +219,12 @@ type ApplyEvent struct {
221
219
222
220
// String returns a string suitable for logging
223
221
func (ae ApplyEvent ) String () string {
224
- return fmt .Sprintf ("ApplyEvent{ GroupName: %q, Status: %q, Identifier: %q, Error: %q }" ,
225
- ae .GroupName , ae .Status , ae .Identifier , ae .Error )
222
+ if ae .Error != nil {
223
+ return fmt .Sprintf ("ApplyEvent{ GroupName: %q, Status: %q, Identifier: %q, Error: %q }" ,
224
+ ae .GroupName , ae .Status , ae .Identifier , ae .Error )
225
+ }
226
+ return fmt .Sprintf ("ApplyEvent{ GroupName: %q, Status: %q, Identifier: %q }" ,
227
+ ae .GroupName , ae .Status , ae .Identifier )
226
228
}
227
229
228
230
type StatusEvent struct {
@@ -242,8 +244,12 @@ func (se StatusEvent) String() string {
242
244
gen = se .PollResourceInfo .Resource .GetGeneration ()
243
245
}
244
246
}
245
- return fmt .Sprintf ("StatusEvent{ Status: %q, Generation: %d, Identifier: %q, Error: %q }" ,
246
- status , gen , se .Identifier , se .Error )
247
+ if se .Error != nil {
248
+ return fmt .Sprintf ("StatusEvent{ Status: %q, Generation: %d, Identifier: %q, Error: %q }" ,
249
+ status , gen , se .Identifier , se .Error )
250
+ }
251
+ return fmt .Sprintf ("StatusEvent{ Status: %q, Generation: %d, Identifier: %q }" ,
252
+ status , gen , se .Identifier )
247
253
}
248
254
249
255
//go:generate stringer -type=PruneEventStatus -linecomment
@@ -266,8 +272,12 @@ type PruneEvent struct {
266
272
267
273
// String returns a string suitable for logging
268
274
func (pe PruneEvent ) String () string {
269
- return fmt .Sprintf ("PruneEvent{ GroupName: %q, Status: %q, Identifier: %q, Error: %q }" ,
270
- pe .GroupName , pe .Status , pe .Identifier , pe .Error )
275
+ if pe .Error != nil {
276
+ return fmt .Sprintf ("PruneEvent{ GroupName: %q, Status: %q, Identifier: %q, Error: %q }" ,
277
+ pe .GroupName , pe .Status , pe .Identifier , pe .Error )
278
+ }
279
+ return fmt .Sprintf ("PruneEvent{ GroupName: %q, Status: %q, Identifier: %q }" ,
280
+ pe .GroupName , pe .Status , pe .Identifier )
271
281
}
272
282
273
283
//go:generate stringer -type=DeleteEventStatus -linecomment
@@ -290,8 +300,12 @@ type DeleteEvent struct {
290
300
291
301
// String returns a string suitable for logging
292
302
func (de DeleteEvent ) String () string {
293
- return fmt .Sprintf ("DeleteEvent{ GroupName: %q, Status: %q, Identifier: %q, Error: %q }" ,
294
- de .GroupName , de .Status , de .Identifier , de .Error )
303
+ if de .Error != nil {
304
+ return fmt .Sprintf ("DeleteEvent{ GroupName: %q, Status: %q, Identifier: %q, Error: %q }" ,
305
+ de .GroupName , de .Status , de .Identifier , de .Error )
306
+ }
307
+ return fmt .Sprintf ("DeleteEvent{ GroupName: %q, Status: %q, Identifier: %q }" ,
308
+ de .GroupName , de .Status , de .Identifier )
295
309
}
296
310
297
311
type ValidationEvent struct {
@@ -301,6 +315,10 @@ type ValidationEvent struct {
301
315
302
316
// String returns a string suitable for logging
303
317
func (ve ValidationEvent ) String () string {
304
- return fmt .Sprintf ("ValidationEvent{ Identifiers: %+v, Error: %q }" ,
305
- ve .Identifiers , ve .Error )
318
+ if ve .Error != nil {
319
+ return fmt .Sprintf ("ValidationEvent{ Identifiers: %+v, Error: %q }" ,
320
+ ve .Identifiers , ve .Error )
321
+ }
322
+ return fmt .Sprintf ("ValidationEvent{ Identifiers: %+v }" ,
323
+ ve .Identifiers )
306
324
}
0 commit comments