Format satisfies the fmt.Formatter interface. See NewFormatter for usage details.
(fs fmt.State, verb rune)
| 369 | // Format satisfies the fmt.Formatter interface. See NewFormatter for usage |
| 370 | // details. |
| 371 | func (f *formatState) Format(fs fmt.State, verb rune) { |
| 372 | f.fs = fs |
| 373 | |
| 374 | // Use standard formatting for verbs that are not v. |
| 375 | if verb != 'v' { |
| 376 | format := f.constructOrigFormat(verb) |
| 377 | fmt.Fprintf(fs, format, f.value) |
| 378 | return |
| 379 | } |
| 380 | |
| 381 | if f.value == nil { |
| 382 | if fs.Flag('#') { |
| 383 | fs.Write(interfaceBytes) |
| 384 | } |
| 385 | fs.Write(nilAngleBytes) |
| 386 | return |
| 387 | } |
| 388 | |
| 389 | f.format(reflect.ValueOf(f.value)) |
| 390 | } |
| 391 | |
| 392 | // newFormatter is a helper function to consolidate the logic from the various |
| 393 | // public methods which take varying config states. |