This example demonstrates how to use ConfigState.Printf to display a variable with a format string and inline formatting.
()
| 200 | // This example demonstrates how to use ConfigState.Printf to display a variable |
| 201 | // with a format string and inline formatting. |
| 202 | func ExampleConfigState_Printf() { |
| 203 | // See the top-level Dump example for details on the types used in this |
| 204 | // example. |
| 205 | |
| 206 | // Create two ConfigState instances and modify the method handling of the |
| 207 | // first ConfigState only. |
| 208 | scs := spew.NewDefaultConfig() |
| 209 | scs2 := spew.NewDefaultConfig() |
| 210 | scs.DisableMethods = true |
| 211 | |
| 212 | // Alternatively |
| 213 | // scs := spew.ConfigState{Indent: " ", DisableMethods: true} |
| 214 | // scs2 := spew.ConfigState{Indent: " "} |
| 215 | |
| 216 | // This is of type Flag which implements a Stringer and has raw value 1. |
| 217 | f := flagTwo |
| 218 | |
| 219 | // Dump using the ConfigState instances. |
| 220 | scs.Printf("f: %v\n", f) |
| 221 | scs2.Printf("f: %v\n", f) |
| 222 | |
| 223 | // Output: |
| 224 | // f: 1 |
| 225 | // f: flagTwo |
| 226 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…