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

Function ExampleConfigState_Dump

internal/spew/example_test.go:164–198  ·  view source on GitHub ↗

This example demonstrates how to use ConfigState.Dump to dump variables to stdout

()

Source from the content-addressed store, hash-verified

162// This example demonstrates how to use ConfigState.Dump to dump variables to
163// stdout
164func ExampleConfigState_Dump() {
165 // See the top-level Dump example for details on the types used in this
166 // example.
167
168 // Create two ConfigState instances with different indentation.
169 scs := spew.ConfigState{Indent: "\t"}
170 scs2 := spew.ConfigState{Indent: " "}
171
172 // Setup some sample data structures for the example.
173 bar := Bar{uintptr(0)}
174 s1 := Foo{bar, map[interface{}]interface{}{"one": true}}
175
176 // Dump using the ConfigState instances.
177 scs.Dump(s1)
178 scs2.Dump(s1)
179
180 // Output:
181 // (spew_test.Foo) {
182 // unexportedField: (spew_test.Bar) {
183 // data: (uintptr) <nil>
184 // },
185 // ExportedField: (map[interface {}]interface {}) (len=1) {
186 // (string) (len=3) "one": (bool) true
187 // }
188 // }
189 // (spew_test.Foo) {
190 // unexportedField: (spew_test.Bar) {
191 // data: (uintptr) <nil>
192 // },
193 // ExportedField: (map[interface {}]interface {}) (len=1) {
194 // (string) (len=3) "one": (bool) true
195 // }
196 // }
197 //
198}
199
200// This example demonstrates how to use ConfigState.Printf to display a variable
201// with a format string and inline formatting.

Callers

nothing calls this directly

Calls 1

DumpMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…