Tags: labstack/gommon
Tags
Fix panic in log with empty header Previously using `l.SetHeader("")` would panic with: --- FAIL: TestEmptyHeader (0.00s) panic: runtime error: index out of range [-1] [recovered] panic: runtime error: index out of range [-1] goroutine 18 [running]: github.com/labstack/gommon/log.(*Logger).log(0xc00014e990, 0x1, {0x5fb505, 0xd}, {0x0, 0x0, 0x0}) /home/martin/src/gommon/log/log.go:394 +0x615 github.com/labstack/gommon/log.(*Logger).Debugf(...) /home/martin/src/gommon/log/log.go:158 github.com/labstack/gommon/log.TestEmptyHeader(0xc000129860?) /home/martin/src/gommon/log/log_test.go:128 +0xb1 This adds a check for that. It also checks if there is any content before writing a space in the "Text header" else branch so you don't end up with " my message".
[Email] client quit instead of close Signed-off-by: Vishal Rana <[email protected]>
[Email] Fixed empty body Signed-off-by: Vishal Rana <[email protected]>
[Email] Text to BodyText & HTML to BodyHTML Signed-off-by: Vishal Rana <[email protected]>
PreviousNext