(v interface{}, f fmt.State, c rune)
| 28 | } |
| 29 | |
| 30 | func defaultFormat(v interface{}, f fmt.State, c rune) { |
| 31 | buf := make([]string, 0, 10) |
| 32 | buf = append(buf, "%") |
| 33 | for i := 0; i < 128; i++ { |
| 34 | if f.Flag(i) { |
| 35 | buf = append(buf, string(rune(i))) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if w, ok := f.Width(); ok { |
| 40 | buf = append(buf, strconv.Itoa(w)) |
| 41 | } |
| 42 | if p, ok := f.Precision(); ok { |
| 43 | buf = append(buf, "."+strconv.Itoa(p)) |
| 44 | } |
| 45 | buf = append(buf, string(c)) |
| 46 | format := strings.Join(buf, "") |
| 47 | fmt.Fprintf(f, format, v) |
| 48 | } |
| 49 | |
| 50 | type flagScanner struct { |
| 51 | flag byte |