@@ -74,7 +74,6 @@ type Event struct {
7474// String returns a string suitable for logging
7575func (e Event ) String () string {
7676 var sb strings.Builder
77- sb .WriteString ("Event{ " )
7877 switch e .Type {
7978 case InitType :
8079 sb .WriteString (e .InitEvent .String ())
@@ -95,7 +94,6 @@ func (e Event) String() string {
9594 case ValidationType :
9695 sb .WriteString (e .ValidationEvent .String ())
9796 }
98- sb .WriteString (" }" )
9997 return sb .String ()
10098}
10199
@@ -221,8 +219,12 @@ type ApplyEvent struct {
221219
222220// String returns a string suitable for logging
223221func (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 )
226228}
227229
228230type StatusEvent struct {
@@ -242,8 +244,12 @@ func (se StatusEvent) String() string {
242244 gen = se .PollResourceInfo .Resource .GetGeneration ()
243245 }
244246 }
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 )
247253}
248254
249255//go:generate stringer -type=PruneEventStatus -linecomment
@@ -266,8 +272,12 @@ type PruneEvent struct {
266272
267273// String returns a string suitable for logging
268274func (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 )
271281}
272282
273283//go:generate stringer -type=DeleteEventStatus -linecomment
@@ -290,8 +300,12 @@ type DeleteEvent struct {
290300
291301// String returns a string suitable for logging
292302func (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 )
295309}
296310
297311type ValidationEvent struct {
@@ -301,6 +315,10 @@ type ValidationEvent struct {
301315
302316// String returns a string suitable for logging
303317func (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 )
306324}
0 commit comments