getMessage format with Sprint, Sprintf, or neither.
(template string, fmtArgs []interface{})
| 370 | |
| 371 | // getMessage format with Sprint, Sprintf, or neither. |
| 372 | func getMessage(template string, fmtArgs []interface{}) string { |
| 373 | if len(fmtArgs) == 0 { |
| 374 | return template |
| 375 | } |
| 376 | |
| 377 | if template != "" { |
| 378 | return fmt.Sprintf(template, fmtArgs...) |
| 379 | } |
| 380 | |
| 381 | if len(fmtArgs) == 1 { |
| 382 | if str, ok := fmtArgs[0].(string); ok { |
| 383 | return str |
| 384 | } |
| 385 | } |
| 386 | return fmt.Sprint(fmtArgs...) |
| 387 | } |
| 388 | |
| 389 | // getMessageln format with Sprintln. |
| 390 | func getMessageln(fmtArgs []interface{}) string { |