(args []interface{})
| 45 | } |
| 46 | |
| 47 | func argsString(args []interface{}) string { |
| 48 | var sargs []string |
| 49 | for _, a := range args { |
| 50 | switch v := a.(type) { |
| 51 | case int: |
| 52 | sargs = appendFmt(sargs, "%d", a) |
| 53 | case float64: |
| 54 | f := "%g" |
| 55 | |
| 56 | // imprecise elimination of 0 decimals |
| 57 | // TODO: better fix this issue on parsing side |
| 58 | if math.Floor(v) == v { |
| 59 | f = "%.0f" |
| 60 | } |
| 61 | |
| 62 | sargs = appendFmt(sargs, f, a) |
| 63 | case string: |
| 64 | sargs = appendFmtEscape(sargs, `"%s"`, `"`, a) |
| 65 | default: |
| 66 | if m, ok := a.(interface{ MarshalText() ([]byte, error) }); ok { |
| 67 | t, err := m.MarshalText() |
| 68 | if err != nil { |
| 69 | sargs = append(sargs, `"[error]"`) |
| 70 | } else { |
| 71 | sargs = appendFmtEscape(sargs, `"%s"`, `"`, string(t)) |
| 72 | } |
| 73 | } else { |
| 74 | sargs = appendFmtEscape(sargs, `"%s"`, `"`, a) |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | return strings.Join(sargs, ", ") |
| 80 | } |
| 81 | |
| 82 | func sortTail(s []string, from int) { |
| 83 | if len(s)-from > 1 { |
no test coverage detected
searching dependent graphs…