MCPcopy Index your code
hub / github.com/expr-lang/expr / ExamplePrintf

Function ExamplePrintf

internal/spew/example_test.go:121–142  ·  view source on GitHub ↗

This example demonstrates how to use Printf to display a variable with a format string and inline formatting.

()

Source from the content-addressed store, hash-verified

119// This example demonstrates how to use Printf to display a variable with a
120// format string and inline formatting.
121func 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.
145func ExampleConfigState() {

Callers

nothing calls this directly

Calls 1

PrintfFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…