MustStringFormatter is equivalent to NewStringFormatter with a call to panic on error.
(format string)
| 260 | // MustStringFormatter is equivalent to NewStringFormatter with a call to panic |
| 261 | // on error. |
| 262 | func MustStringFormatter(format string) Formatter { |
| 263 | f, err := NewStringFormatter(format) |
| 264 | if err != nil { |
| 265 | panic("Failed to initialized string formatter: " + err.Error()) |
| 266 | } |
| 267 | return f |
| 268 | } |
| 269 | |
| 270 | func (f *stringFormatter) add(verb fmtVerb, layout string) { |
| 271 | f.parts = append(f.parts, part{verb, layout}) |