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.
()
| 45 | // unrecognized type. Unless new types are added to the language, this |
| 46 | // function won't ever be called. |
| 47 | func (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 |