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

Method Format

internal/spew/format.go:371–390  ·  view source on GitHub ↗

Format satisfies the fmt.Formatter interface. See NewFormatter for usage details.

(fs fmt.State, verb rune)

Source from the content-addressed store, hash-verified

369// Format satisfies the fmt.Formatter interface. See NewFormatter for usage
370// details.
371func (f *formatState) Format(fs fmt.State, verb rune) {
372 f.fs = fs
373
374 // Use standard formatting for verbs that are not v.
375 if verb != 'v' {
376 format := f.constructOrigFormat(verb)
377 fmt.Fprintf(fs, format, f.value)
378 return
379 }
380
381 if f.value == nil {
382 if fs.Flag('#') {
383 fs.Write(interfaceBytes)
384 }
385 fs.Write(nilAngleBytes)
386 return
387 }
388
389 f.format(reflect.ValueOf(f.value))
390}
391
392// newFormatter is a helper function to consolidate the logic from the various
393// public methods which take varying config states.

Callers 3

TimeEqualStringMethod · 0.80
TestWithTimezone_dateFunction · 0.80
TestBuiltinFunction · 0.80

Calls 5

constructOrigFormatMethod · 0.95
formatMethod · 0.95
FprintfMethod · 0.80
FlagMethod · 0.80
WriteMethod · 0.80

Tested by 2

TestWithTimezone_dateFunction · 0.64
TestBuiltinFunction · 0.64