This example demonstrates how to use Printf to display a variable with a format string and inline formatting.
()
| 119 | // This example demonstrates how to use Printf to display a variable with a |
| 120 | // format string and inline formatting. |
| 121 | func ExamplePrintf() { |
| 122 | // Create a double pointer to a uint 8. |
| 123 | ui8 := uint8(5) |
| 124 | pui8 := &ui8 |
| 125 | ppui8 := &pui8 |
| 126 | |
| 127 | // Create a circular data type. |
| 128 | type circular struct { |
| 129 | ui8 uint8 |
| 130 | c *circular |
| 131 | } |
| 132 | c := circular{ui8: 1} |
| 133 | c.c = &c |
| 134 | |
| 135 | // Print! |
| 136 | spew.Printf("ppui8: %v\n", ppui8) |
| 137 | spew.Printf("circular: %v\n", c) |
| 138 | |
| 139 | // Output: |
| 140 | // ppui8: <**>5 |
| 141 | // circular: {1 <*>{1 <*><shown>}} |
| 142 | } |
| 143 | |
| 144 | // This example demonstrates how to use a ConfigState. |
| 145 | func ExampleConfigState() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…