1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:04:49 -07:00

internal/event: don't print invalid labels

Change-Id: I781dfbd37aefe352c74d0df0af9da52bbf09fdcc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/229989
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Ian Cottrell 2020-04-26 21:29:37 -04:00
parent 479cc23432
commit bed5418863

View File

@ -61,8 +61,9 @@ func (ev Event) Format(f fmt.State, r rune) {
fmt.Fprint(f, ev.at.Format("2006/01/02 15:04:05 "))
}
for index := 0; ev.Valid(index); index++ {
l := ev.Label(index)
fmt.Fprintf(f, "\n\t%v", l)
if l := ev.Label(index); l.Valid() {
fmt.Fprintf(f, "\n\t%v", l)
}
}
}