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

Method buildDefaultFormat

internal/spew/format.go:47–60  ·  view source on GitHub ↗

buildDefaultFormat recreates the original format string without precision and width information to pass in to fmt.Sprintf in the case of an unrecognized type. Unless new types are added to the language, this function won't ever be called.

()

Source from the content-addressed store, hash-verified

45// unrecognized type. Unless new types are added to the language, this
46// function won't ever be called.
47func (f *formatState) buildDefaultFormat() (format string) {
48 buf := bytes.NewBuffer(percentBytes)
49
50 for _, flag := range supportedFlags {
51 if f.fs.Flag(int(flag)) {
52 buf.WriteRune(flag)
53 }
54 }
55
56 buf.WriteRune('v')
57
58 format = buf.String()
59 return format
60}
61
62// constructOrigFormat recreates the original format string including precision
63// and width information to pass along to the standard fmt package. This allows

Callers 1

formatMethod · 0.95

Calls 2

FlagMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected