MCPcopy Create free account
hub / github.com/expr-lang/expr / ExampleConfigState_Printf

Function ExampleConfigState_Printf

internal/spew/example_test.go:202–226  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

200// This example demonstrates how to use ConfigState.Printf to display a variable
201// with a format string and inline formatting.
202func 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}

Callers

nothing calls this directly

Calls 2

NewDefaultConfigFunction · 0.92
PrintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…